Skip to main content
10 events
when toggle format what by license comment
Nov 2, 2012 at 4:23 comment added Adam @AhmadM Thanks mate. I am aware of the var already being defined, however that does not make it a requisite to pass into the hook/function. In this case the OP wants to remove the meta box from the post post_type which is why the initial solution will allow for granular control. However in the case where you want to remove it for all post types then using the already defined var $post_type is satisfactory. What I will do, is edit my answer to include your additional example using the $post_type variable for situations where someone may want to apply this to all registered post_types.
Nov 1, 2012 at 18:11 comment added Ahmad M @userabuser: Thanks for clarification, but $post_type is already defined and ready to be used by the add_meta_boxes action hook functions, please see Adam Brown sorce view of this action hook. Utilizing $post_type in this case will make the code independent of the post_type editing screen, meaning it will remove wpseo_meta meta box from all the post types it is found on, and will return nothing in case wpseo_meta is not found.
Oct 30, 2012 at 16:46 history edited Adam CC BY-SA 3.0
manage_plugins should be activate_plugins
Oct 30, 2012 at 16:39 comment added Adam @Ahmad M thanks for suggested edit but $post_type var and action argument parameter is not required in this instance and does not throw notice/error. Also if you include $post_type var you need to define the post type within the function elsewhere which you did not do, so user would have run this to have it work improperly! In this case its perfectly acceptable to pass in post type name i.e. as 'post' directly into remove_meta_box function. Thanks for suggestion anyway.
Oct 30, 2012 at 16:03 history edited Adam CC BY-SA 3.0
No explanation for your edit, see my note.
S Oct 30, 2012 at 16:01 history suggested Ahmad M CC BY-SA 3.0
`add_meta_boxes` action hook pass `$post_type` as an argument to the function.
Oct 30, 2012 at 15:54 review Suggested edits
S Oct 30, 2012 at 16:01
Oct 30, 2012 at 13:23 comment added kaiser +1 for yoast_is_toast().
Oct 29, 2012 at 21:38 history edited Adam CC BY-SA 3.0
added 220 characters in body
Oct 29, 2012 at 21:29 history answered Adam CC BY-SA 3.0