I added the following to my functions.php file and it worked:
function toolset_fix_custom_posts_per_page( $query_string ){
if( is_admin() || ! is_array( $query_string ) )
return $query_string;
$post_types_to_fix = array(
array(
'post_type' => 'news_article',
'posts_per_page' => 6
),
// add another if you want
/*
array(
'post_type' => 'movie',
'posts_per_page' => 2
),
*/
);
foreach( $post_types_to_fix as $fix ) {
if( array_key_exists( 'post_type', $query_string )
&& $query_string['post_type'] == $fix['post_type']
) {
$query_string['posts_per_page'] = $fix['posts_per_page'];
return $query_string;
}
}
return $query_string;
}
add_filter( ‘request’, ‘toolset_fix_custom_posts_per_page’ );
Related Posts:
- PageNavi redirects to 404 when used as archive page
- Wp Pagenavi how to display all results
- Help making my pagination plugin better
- Help With A Reverse Pagination Plugin
- How to add pagination to wpbakery grid?
- Infinite Scroll for both Index, Category and Archive
- Dropdown menu on custom page with product to choose number of products per page
- Admin Panel pagination link styles
- Pagination Broken on Static Pages but Works on Blog Articles
- Plugin dropping pagination variable
- how to use in custom single.php template using php?
- How to show only next post pagination link using wp_link_pages()
- pagination on data fetched using SQL query
- How to apply next/previous classes to LIs for pagination links?
- Replacing global wp_query
- Change the number of plugins counted on wp-admin/plugins.php
- speed up pagination for huge database
- Article content navigator in wordpress like mbaskool website
- Pagination/404 I believe wp is getting a page ahead of itself
- Pagination not working
- Permalinks and pagination are not working in WordPress with WP e-Commerce plugin
- How to disable Wp-PageNavi at the top of the page
- how to show all posts of each category in pages
- How to Join wp_posts & wp_postmeta table using custom query
- Enable comments pagination only amp page
- Ajax Load More on Hierarchical Categories
- get recent 12 days post then random in wordpress
- homepage olderposts link showing page not found
- Pagination in category
- wp_pagination not displaying at top of page
- Next and Previous Pagination button not displaying in WordPress
- WooCommerce custom query and paging: Not Found error
- Infinite scroll for text in post with url page change
- How to create load more button without a plugin?
- Gutenberg disallow certain custom blocks but keep all core blocks?
- LaTex MarkUp – align equations
- Why does WordPress still not support SFTP?
- Is their any way to Extend WPDB class and Overwrite the Default Query Function
- How do I only load a plugin js on it’s settings pages?
- Best way to inject css into admin_head in plugins?
- Release a plugin with composer installed packages
- Use functionality of 2 wordpress plugins
- Suggestions for i18n plugin [closed]
- Hide plugin list
- WP-Members redirect if member ALREADY logged in
- Can WordPress plugins “Talk to each other”?
- Get a list of galleries from an album in NextGEN Gallery [closed]
- Undefined property: WP_Post_Type::$ID
- How to remove html code in excel downloads using phpspreadsheet with wordpress plugins shortcode
- Making a plugin “Suite”?
- Automatically add attributes to woocommerce product?
- How to override a plugin function wrapped in a class?
- submit posts by unregistered users in wordpress
- Programmatically Process Order through WooCommerce/Stripe Payment Gateway [closed]
- How do I get fresh post data in post_publish hook?
- How do I log out users from a restricted page if they are already logged in on another device? [closed]
- Getting Theme element into plugins page editor in wp admin
- get main product category list woocommerce
- How do I enforce users to fill a determined custom field using WyPiekacz?
- How do I create a Client Logos section in admin menu?
- Options for math equations rendering in WP in own server
- Support information in backend
- http_response_timeout filter not working
- wp_enqueue_style for plugin options page
- Popular Post With Thumbnail?
- How to select a paragraph other than the 1st to be the post’s excerpt?
- Where Should i write the code for wordpress ajax voting?
- Do I need a backup plugin if I’m already backing up via cPanel?
- oAuth2 Authentication in WordPress using WP OAuth Server and WP API plugins
- WP::is_main_query() Not Working
- post_content is empty
- Widget where it can make changes to the container
- WordPress – “tag page” additional, custom content
- Making a Contact Form 7 calendar entry “required” [closed]
- W3 Total Cache plugin chronic message
- Get all image in media Gallery with alt/title?
- how to add custom culomn to add user wordpress in plugin
- How to add specific script to WordPress webpage that will working with user input and databases
- Displaying different content depending on variable
- Found wp_deregister_script WARNING in redux framework plugin
- After reading 3 story by user ask for subscription popup
- Pay Employee via WordPress
- Fatal error: Uncaught Error: Call to undefined function
- Display information from metabox
- Need woocommerce function for getting cart list with items
- WPNeo Stripe connect does not work
- Allowing Comments on Posts
- Creating Custom Hook for my plugin
- Web Application Framework Compatibility with WP Plugin
- Showpost and last
- How to install wordpress theme’s plug-ins?
- Filter EVERY category link with my plugin
- [Custom field template plugin] Upload limited to 20 inputs file
- New admin account cant access plugins.php
- Website keeps going down, is it a plugin, database, memory problem, or something else?
- Woocommerce resize existing product images
- Sort posts by Date (DESC) and by ACF: active_inactive (ASC)
- wp-login 404 page not redirecting to homepage [closed]
- WordPress Paypal Error “Authentication with PayPal failed: Could not create token.”
- Convert WordPress into Event and membership managment software [closed]