• Hi there,

    One thing I noticed about your handy little plugin is that it shows the Featured Image column for all post types, regardless of whether or not they even support featured images.

    In the filter that adds the column, you could consider adding logic along these lines:
    // only add the column for types that support it
    global $typenow;
    if ( ! post_type_supports( $typenow, ‘thumbnail’ ) ) {
    return $columns;
    }

    Cheers

Viewing 1 replies (of 1 total)
  • Note: The original snippet I presented makes the image disappear when Quick Edit is submitted because $typenow isn’t defined, so here’s an update that should work better:

    global $typenow;

    if ( $typenow ) {

    $current_post_type = $typenow;

    } else {

    // AJAX refresh after Quick Edit
    if ( isset( $_POST[‘post_type’] ) && $_POST[‘post_type’] ) {
    $current_post_type = $_POST[‘post_type’];
    }

    }

    for the first bit. This should preserve the image after a Quick Edit is submitted.

Viewing 1 replies (of 1 total)
  • The topic ‘Consideration: Logic for when to display column’ is closed to new replies.