This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

Remove meta boxes for Pages and Posts

  • Creator
  • #9256

    I have a question about a section in the documentation titled “Remove meta boxes for Pages and Posts“. I added the code below to my child theme functions file and the meta data (post date, author, category, comment count) is still at the top of the post.

    function remove_meta_boxes( $setup ) {
        $setup['meta']['pages'] = false;
        $setup['meta']['posts'] = false;
        return $setup;
    add_filter( 'themeblvd_global_config', 'remove_meta_boxes' );

    1) Is there something else I need to do in order to remove the post meta?

    2) Can this work for custom post types as well? For example?

    $setup['meta']['services'] = false;
Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
  • #9265
    Jason Bobich


    This code snippet is incorrect in the article, and I’ve fixed it. However, I think you’re misunderstanding what this is referring to. — This is referring to the “Post Options” and “Page Options” meta boxes that the theme adds. So, this doesn’t have anything to do with any meta boxes that WordPress or other plugins would be adding.


    Got it. Now I understand. Thank you.

    To remove the meta data on the post, I am using a template part and manually removing the call to themeblvd_blog_meta();. It would be really slick to remove/alter this content with a filter like you do for template parts.

    After a little digging…

    Hey, if themeblvd_blog_meta() is an action hook, can’t I conditionally modify the output?

    // alter the metadata that is returned at the top of the post
    function rum_alter_post_metadata() {
        // if the post type is SERVICES, don't display any metadata at the top of the post
        if ( 'services' == get_post_type() ) {
            // return an empty string -or- don't echo anything
    add_action( 'themeblvd_blog_meta', 'rum_alter_post_metadata' );

    Is there a better way to do this?

    I also have noticed that if I use a custom post type with a taxonomy, the category field in the metadata output is blank. I could adjust the output to account for that using this method as well, right?

    Jason Bobich

    I don’t know that I quite see the logic here. If you want to use a shared template part between the standard post type and some custom post type, I’d just account for that in that template part.

    So for example, if you’re using content-list.php, you could have something like this:

    <header class="entry-header">
    	<h1 class="entry-title entry-title-with-meta"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h1>
    	<?php if ( 'services' != get_post_type() ) : ?>
    		<?php themeblvd_blog_meta(); ?>
    	<?php endif; ?>
    </header><!-- .entry-header (end) -->

    I also have noticed that if I use a custom post type with a taxonomy, the category field in the metadata output is blank.

    Sure, this is expected if your custom post type does not associate the default category taxonomy, right? If your “services” post type uses different taxonomies, and you want to show them, you’d probably want to create your own meta function for that post type.

    It could even go like this in content-list.php

    <?php if ( 'services' == get_post_type() ) : ?>
    	<?php my_services_meta(); ?>
    <?php else : ?>
    	<?php themeblvd_blog_meta(); ?>
    <?php endif; ?>
Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.