I’ve created a plugin using custom post types and I need to force the default two column post page to a single column. At the same time, the Publish metabox must move to the bottom. I need to do this via the functions some how.
I have some solutions from WPSE, but the only solution I’ve found actually hides the “Publish” metabox. I can’t seem to figure out why.
Any ideas of how to do this?
There is a filter called
get_user_option_meta-box-order_{$page}
where$page
is the name of the post type. Just make sure thatsubmitdiv
is the last value in the array:One approach is to remove the original metabox, and then to re-add that metabox, with updated parameters. For example, this will move the “Featured Image” meta box from the side column to the main column, for a custom post type with a slug
cpt-slug
:Edit
The parameter for the Publish meta box is
submitdiv
, and the correct callback ispost_submit_meta_box()
; I’ve updated the code below to reflect these correct parameters. I’ve also changed theadd_meta_box()
$context
parameter from'high'
to'low'
, so that the Publish meta box will be added at the bottom:The approach should be the same for the “Publish” meta box. You just need to remove/add the publish meta box instead of the featured image meta box.
To answer the second part of the question –
How to force one column
, you can do it withget_user_option_screen_layout_{Post_type}
filter. Let’s say forproduct
post-type: