Support » Plugins » Hacks » manage_posts_columns filter fires for CPT’s

Viewing 4 replies - 1 through 4 (of 4 total)
  • allm

    (@realblueorange)

    I’ll answer it myself:

    After a lot of searching and trying this seems to work:

    add_filter( “manage_edit-post_columns” , ‘function1’ );
    add_action( “manage_post_custom_column” , ‘function2’, 99, 2 );

    Note that the action name is NOT manage_posts_custom_column (note the s) which will target COT’s as well.

    At least this is what now works for me.

    I’ll leave this thread open for a short while, just in case someone wants to shine a light on this as well…

    allm

    (@realblueorange)

    Sorry,

    add_action( "manage_post_custom_column" , 'function2', 99, 2 );

    will not work.

    Does anybody now what action will target only regular posts and NOT CPTs?

    Moderator bcworkz

    (@bcworkz)

    The action we use for CPTs is a dynamic hook: “manage_{$post->post_type}_posts_custom_column”

    You should be able to turn that around and use it exclusively for “post” post types with “manage_post_posts_custom_column”. This is an action distinct from ‘manage_posts_custom_column’ which fires for all non-hierarchical posts of any type.

    allm

    (@realblueorange)

    @bcworkz
    Thanks a lot! This seems to work. I thought I tried that first yesterday, but apparently not. Just to be thorough I also tried variations AND looked at the source to no avail.

    This helped me back on track. Thanks again. Have a great day!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘manage_posts_columns filter fires for CPT’s’ is closed to new replies.