Remove Post Meta or Post Info from Custom Post Types

It happens fairly often that we have a client who needs a custom post type as well as the usual blog/news feature. We need post meta and/or post info to show up for the news posts, but we don’t need that information on the custom post type since that information tends to be fairly static, and we don’t really care who the author of an attorney bio is, or who updated a used equipment list. The top snippet is how we pulled that stuff out of CPTs in Genesis v1.

Note that before we can write a function that addresses the custom post type, we have to add another function that makes that possible. We’re going to add this to our standardized functions file (which I’ll write about some other time).

Update

With Genesis 2 out, and changes made to the templates to support HTML5, some of the hooks have changed. Also, you no longer have to write that first function to enable the conditional. If you’re using Genesis 2, follow the second snippet below.

10 Comments

  1. Mike on June 27, 2013 at 12:04 pm

    This is just what I was looking for and found it searching for ‘post type custom remove meta’. Appreciate it!



  2. Dave Kuhar on June 27, 2013 at 12:29 pm

    Glad to help, Mike!



  3. Yael on February 12, 2014 at 4:22 am

    Thank you, Dave,was exactly what I was needing!



    • Dave Kuhar on February 25, 2014 at 8:53 pm

      That’s good to hear, thanks!



  4. floyd on May 7, 2014 at 12:16 am

    Thank you …just what the dr ordered.



  5. […] I searched for a snippet to remove the post meta from custom post types using Genesis and I found this article from Transmit Studio. The snippet they give works perfectly but it checks only one post type at a […]



  6. Regina Smola on January 31, 2015 at 2:32 pm

    Thanks alot Dave. Worked perfectly!

    Question for you. What if you have more than one Custom Post Type you want to remove post meta and post info from. How do you hide on CPTNAME1, CPTNAME2, and CPTNAME3?



    • Dave Kuhar on February 3, 2015 at 1:45 pm

      Glad to help! Take a look at the second snippet up there…I’ve added instructions for testing for as many CPTs as you like.



  7. Porter on April 24, 2015 at 3:12 pm

    Thanks for the code snippet, it’s exactly what I was looking for, and was sitting nicely as the top search result 🙂



    • Dave Kuhar on April 27, 2015 at 12:51 pm

      Don’t you love when that happens?