Need functionality with all post list available at edit.php

I have solved the main query:

For WordPress dashboard, I needed the list of all posts related to all post types in:

edit.php?post_type=product

Using the concept of:

edit.php?post_type=product&showall=true

With function in backend function.php

function show_all_posttypes( $query ) {
    if( ! is_admin() ) {
         return;
    }

    if( isset( $_GET, $_GET['showall'] ) && true == $_GET['showall'] ) {
        $query->set( 'post_type', array('product', 'second_type_product', 'third_type_product') );
    }   
}

add_filter( 'pre_get_posts', 'show_all_posttypes' );

And after that my all posts related to three post types: product, second_type_product, third_type_product is listing very well on URL:

edit.php?post_type=product&showall=true

But when I am using its feature to filter on edit.php page with all listed posts then is saying:

Invalid post type

I want to achieve every feature support with my list related to multiple post types list on url based on one post type.

Thanks for support!

3 Answers
3

Invalid Post Type might be shown,whenever you have a mistake(type or etc..) in 'product', 'second_type_product', 'third_type_product' . Ensure that you have correct words there.

Leave a Comment