WordPress.org

Support

Support » How-To and Troubleshooting » Add Meta Boxes ignoring $context for pages

Add Meta Boxes ignoring $context for pages

  • graphicgeek
    Member

    @graphicgeek

    I have a custom meta box that I add to the editor for all pages and posts. I want the box to appear on the side of the editor, and it does, but only for posts. When editing pages, it appears below the content editor. Here is my code:

    function gg_meta_boxes (){
     add_meta_box('gg_extra_page_meta', 'Page Options', 'gg_extra_page_meta', 'post', 'side', 'low');
     add_meta_box('gg_extra_page_meta', 'Page Options', 'gg_extra_page_meta', 'page', 'side', 'low');
    }
    
    add_action( 'add_meta_boxes', 'gg_meta_boxes' );

    The two add_meta_box calls look exactly the same to me, and yet the post get the context right, while the page doesn’t. Any ideas?

  • The topic ‘Add Meta Boxes ignoring $context for pages’ is closed to new replies.