WordPress SEO by Yoast: Hide Meta Boxes in Posts for Non-admins

It didn’t say in the API docs on the Yoast SEO plugin site what the ID was and I don’t have a copy of Yoast at installed at disposal, but according to yoas-plugin-dir/admin/class-metabox.php line 144, the meta_box registered is; add_meta_box( ‘wpseo_meta’, …etc ); … Which is hooked onto add_meta_boxes hook on line 32 of the … Read more

Change The Title Of a Meta Box

Improved Answer I’ve decided to revisit this question after realising how unnecesarily hacky it is. The the best solution is to to remove the metabox, and then re-add it, specifying an alternative title. Here’s an example for the post post-type. add_action( ‘add_meta_boxes_post’, ‘wpse39446_add_meta_boxes’ ); function wpse39446_add_meta_boxes() { remove_meta_box( ‘authordiv’, ‘post’, ‘core’ ); add_meta_box( ‘authordiv’, __(‘Team … Read more

What is the “Advanced” $context in add_meta_box?

The difference between normal and advanced is that normal will be placed on the page before advanced. For example the following will display “One” before “Two” function admin_init_test() { add_meta_box(‘one’, __(‘One’), ‘test_one’, ‘post’, ‘advanced’); add_meta_box(‘two’, __(‘Two’), ‘test_two’, ‘post’, ‘normal’); } add_action(‘admin_init’, ‘admin_init_test’); function test_two() { echo “<p>test_two</p>”; } function test_one() { echo “<p>test_one</p>”; } If … Read more

How to HIDE everything in PUBLISH metabox except Move to Trash & PUBLISH button

You can simply hide the options using CSS. This will add a display:none style to the misc and minor publishing actions on the post.php and post-new.php pages. It checks for a specific post type as well since all post types use these two files. function hide_publishing_actions(){ $my_post_type=”POST_TYPE”; global $post; if($post->post_type == $my_post_type){ echo ‘ <style … Read more

Metabox with checkbox is not updating

Here is code I have used before – the main difference looks to me that you are checking if the meta exists rather than what it’s value is to determine if it should be checked. // Checkbox Meta add_action(“admin_init”, “checkbox_init”); function checkbox_init(){ add_meta_box(“checkbox”, “Checkbox”, “checkbox”, “post”, “normal”, “high”); } function checkbox(){ global $post; $custom = … Read more

Does WordPress have a “Form API”?

No, but it should 😉 There are several custom field class’s (backend). wpAlchemy : https://github.com/farinspace/wpalchemy Meta Box Script: https://github.com/rilwis/meta-box My-Meta-Box: https://github.com/bainternet/My-Meta-Box meta-box-class: https://github.com/corycrowley/meta-box-class Meta Boxes Class: https://github.com/Bakke/Wordpress-Custom-Meta-Boxes-Class For front-end forms, you probably best off with a plugin in Eugene Manuilov’s link.