Support » Fixing WordPress » hide/remove custom_column from custom_post_type admin panel

  • Resolved Masoud

    (@masoud1111)


    hi.
    i’m using the latest version of wordpress.
    i’m working on a food website.
    it has a special area for Recipes (post type = recipe )
    in there, there is a column which i want to hide from non-admin (authors).
    i’ve searched a lot , and tried lots of codes, but none of them worked.
    also i’ve downloaded some plugin to remove that column but again they are not working for me.

    please look at the related picture.

    any help will be appreciated very much. thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You can do that by using the following > https://codex.wordpress.org/Plugin_API/Filter_Reference/manage_edit-post_type_columns

    There is an example below which specifically show you how to remove the “author” column.

    @wppatrickk
    many thanks for help.
    i dont know exatly if the column name is difficulty or recipe_difficulty, so i typed both of them
    i tried the code :

    function my_columns_filter( $columns ) {
       unset($columns['recipe_difficulty']);
       unset($columns['difficulty']);
       return $columns;
       }
    add_filter( 'manage_edit-page_columns', 'my_columns_filter',10, 1 );
    add_filter( 'manage_edit-post_columns', 'my_columns_filter',10, 1 );
    add_filter( 'manage_edit-recipe_columns', 'my_columns_filter',10, 1 );

    but no change has come to the column.
    any other suggestions you might have?
    and thanks again.

    ok, thanks to you guys.
    the problem is solved.

    add_filter( 'manage_edit-recipe_columns', 'my_columns_filter',10, 1 );
    function my_columns_filter( $columns ) {
        unset($columns['taxonomy-recipe_difficulty']);
        return $columns;
    }
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘hide/remove custom_column from custom_post_type admin panel’ is closed to new replies.