Display ALL posts for a specific custom post type
-
I would to display all posts in an archive for a specific custom post type.
I have tried the following but not working.
function all_posts_custom_posts( $query ) { $post_type = get_post_type(); if ( 'restaurants' == $post_type ) { $query->query_vars['posts_per_page'] = -1; return; } } add_action('pre_get_posts', 'all_posts_custom_posts', 1);
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Display ALL posts for a specific custom post type’ is closed to new replies.