Remove Post Meta On Pages, Posts & Archives

You can use either CSS or PHP code to customize the display of post meta on your:

  • Home page
  • Blog page
  • Category archives
  • Tag archives
  • Site Wide
Note: XHTML & HTML 5 themes use different classes and loop hooks so you will need to use the right code to make it work. Also, PHP code will not work if you have the Genesis Simple Edits plugin activated as it uses the same hooks and over-rides functions code

Example 1: This code removes the post meta on sites running HTML 5 and will not work on XHTML sites.

remove_action( 'genesis_entry_header', 'genesis_post_meta', 12 );

Example 2: This code removes the post meta on sites running XHTML and will not work on HTML 5 sites.

remove_action( 'genesis_after_post_content', 'genesis_post_meta' );

What is Post Meta?

Post meta is the data displayed when you assign your posts to one or more categories and tag your posts with one or more tags.

Example:

post meta

It is generally displayed at the end of your single posts and on archive pages like your blog page, home page, categories page and tag archive pages.

How To Find Post Meta Classes

The easiest way to find the classes you need to target to remove both post meta for categories and tags is to use a web development tool named Firebug.

You can then inspect the tagged under and filed under elements and view the classes.

Lets take a look at removing post meta for both categories and tags on all pages they are displayed in WordPress.

Note: These code snippets are based on using the Genesis theme framework however you can easily modify theme and replace the CSS classes to match the theme you are using.

Remove Post Meta On Home Page

This code will remove the post meta for tags on all posts which are displayed on the homepage:

.home .post-meta .tags {
    display: none;
}

This code removes the categories post meta on all posts on your homepage:

.home .post-meta .tags {
    display: none;
}

This code will remove post meta for both categories and tags from displaying on the home page.

.home .post-meta,  
.categories, 
.tags { 
    display: none; 
}

Remove Post Meta From Blog Page Archives

Here’s the CSS code for removing posts meta for both categories and tags from all posts included in your blog page archives.

.page-template-page_blog-php .post-meta,  
.categories, 
.tags { 
     display: none; 
}

Remove Post Meta On Categories Archives Page

Simply use the code above and replace the .home with your blog page template class.

This code will remove the post meta for categories and tags on all posts which are displayed on the categories archives page with an i.d of 123:

.category-123 .post-meta,  
.categories, 
.tags { 
    display: none; 
}

Remove Post Meta From Tag Archives

Use this code to remove posts meta from all posts in your tag archives.

.tag .post-meta,  
.categories, 
.tags { 
    display: none; 
}

Remove Posts Meta Site Wide

There’s different ways to remove all your post meta from your entire site.

Here’s the CSS code to remove post meta for both categories and tags from all single posts and all archive pages site wide.

.post-meta,  
.categories, 
.tags { 
    display: none; 
}

Here’s the PHP code to remove post meta from your entire site when using the Genesis theme framework:

remove_action( 'genesis_after_post_content', 'genesis_post_meta' );

PHP code not displaying or executing? Grab it from Github.

PHP – Remove Post Meta On All Pages

This code will remove the post meta from displaying on all pages including your home page, blog page, category and tag archive pages.

add_action ( 'genesis_meta' , 'remove_post_meta_pages' );
function remove_post_meta_pages() {
	if ( is_page () )
	remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
}

You could also code it this way:

add_action ( 'genesis_meta' , 'remove_entry_meta_from_archive_pages' );
function remove_entry_meta_from_archive_pages() {
	if ( is_page() )
	remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
}

Remove Post Info and Entry Meta from single pages

add_action ( 'genesis_meta' , 'remove_post_meta_pages' );
function remove_post_meta_pages() {
	if ( is_singular('page') )
	remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
        remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
}

You can modify this code to remove post meta for either tagged with and filed under category.

PHP – Remove Post Meta From All Single Posts

add_action ( 'genesis_meta' , 'remove_entry_meta_single_posts' );
function remove_entry_meta_single_posts() {
	if ( is_singular('post') )
	remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
}

This code will remove all your posts meta from single posts.

Using Conditional Tags For Removing Post Meta

Using conditional tags enables you to remove post meta from displaying anywhere on your site.

Simply change the tag in the code and you can not only remove the post meta data, but also the HTML code it outputs in your source code.

CSS code will NOT remove the output of HTML code in your source code which is scanned by the search engine bots. It will simply hide the post meta from displaying on the front end.

Using Plugin To Remove Post Meta

You can also install the Genesis Simple Edits plugin and remove the shortcodes for the post meta you do not wish to display globally.

Post Meta Shortcodes Genesis

I hope you have found this post useful and discovered an easy way to remove post meta from your own website.


Comments

12 responses to “Remove Post Meta On Pages, Posts & Archives”

  1. How to remove post meta tags (Tagged With:) only on frontpage?

    1. Brad Dalton Avatar
      Brad Dalton

      Add the is_front_page() conditional tag after the function name.

  2. Removing Post Meta from your archive pages
    [code]
    .archive .post-meta {
    display: none;
    }
    [/code]

    1. Brad Dalton Avatar
      Brad Dalton

      Thanks Dennis

  3. Hi Brad, I have a question similar to what you wrote about: Is there a way I can remove the viewport meta tag from a single page? I have a form in table form that would be tough to edit for responsive browsing, so I want that specific page to be unresponsive.

    Thanks for your help.

    1. Brad Dalton Avatar
      Brad Dalton

      Good question Ian. I know you can add a custom body class conditionally or using the Edit Post settings.

      I would ask SP technical support this question and interested in what their reply is.

      1. I’ll let you know what I find.

        1. Brad Dalton Avatar
          Brad Dalton

          No worries Ian.

  4. Katerina Avatar
    Katerina

    Hello, I use your php code to remove post-meta from all pages except single posts and it works fine. When I try to do the same with post-info it won’t work! Post-info is still there both in posts and blog pages. The code I use is

    // Remove post-info from archives
    add_action ( ‘genesis_post_content’ , ‘remove_post_info_home’ );
    function remove_post_info_home() {
    global $post;

    if ( !is_single () )
    remove_action( ‘genesis_before_post_content’, ‘genesis_post_info’ );
    }

    Any ideas?

    1. Brad Dalton Avatar
      Brad Dalton

      The conditional tag needs to be changed to

      if ( is_single() || is_page() ) {

  5. Although the result of your tips is that seemingly the postmeta is removed, it is still there. display:none; does nothing more than not displaying the data, but it is far different from removing it, because when you look in your source, you will still see the actual postmeta. Therefore I finf the title of your post a bit misleading. just m2c

    1. hahaha. That’s why i also included the PHP so its doesn’t output in the source code.

      Most people hide the display based on appearance preferences.

      This way you achieve an uncluttered look but still allow the post meta in the source code so the search engines pick it up.

      Otherwise use the PHP.

Leave a Reply

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.