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?
- to perform the requested action wordpress needs to access your web server. please enter your ftp
- How to edit a wordpress plugin without break its update process
- Rewriting every url
- Is there a good plugin for an online booking system..? [closed]
- Automating deprecated call checks?
- How can I make my custom shortcode work in a Custom HTML Widget?
- post_id always wrong in plugin
- Which hook callback has priority if both plugin and theme use the same hook?
- Adding a form at the end of the content
- Creating a wordpress plugin where users can override templates
- How to use static flattr buttons
- Allow Facebook to preview posts before published
- Can I run multiple queries with $wpdb->prepare?
- Get Plugin Information from Multiple Sites Externally
- javascript onload calling a function of a plugin
- Multisite Widget/Content
- May i Use ShortCode in Template?
- Best way to hook a custom url?
- plugin ajax to external php file always return null
- Best way to modify a plugin with no hooks and no pluggable functions?
- Theme and plugin install or update display error in localhost
- Multiple sites, multiple countries
- Theme my Login plugin, how to update fields
- Is there a plugin-log plugin? [closed]
- Create a navbar filter that filters by a custom field
- Advanced Custom Field DatePicker [closed]
- Polylang : Interverting languages after development [closed]
- How to set Noindex to all wordpress pages in a catergory?
- Admin AJAX doesn’t work in plugin admin page – Even though code is copied verbatim from WordPress Codex
- WP_Query for custom post type and category_id not working
- How do i get file_get_contents to work in wordpress
- Plugin Development – Functions or Hooks?
- Making that Admin Bar transparent or a blue color
- How can I automatically download all images from all imported posts, place them on my new host, and replace all the links
- Looking for a free quiz plugin which saves the candidates answers for review [closed]
- Allowing .rfa Files In Media Upload [duplicate]
- What is the purpose of a companion plugin
- WordPress: Add custom add_filter for custom functions
- How to download and unpack / install plugins with templates when installing it
- Calling a class method instantiated by ajax call in wordpress [closed]
- Which Membership Plugins Allow Registered Users To Bookmark Posts? [closed]
- Per theme plugins?
- Calling PHP function with AJAX
- How to detect 404 url and make this link underline or change background color?
- “Enable Media Replace” plugin does not update serialized object in WPMeta
- Failed to load resource: the server responded with a status of 500 () post.php
- Set plugin page as homepage
- WordPress Plugin Install / Update Problem
- error plugins learnpress in wordpress
- How to prevent authors from editing their post count?
- GET web api method from a WordPress PHP script
- Adding link on title its in description but not in title see screenshots attached
- How should I use a plugin function as a hook?
- Fatal error when accessing Pages in WP admin (and problems editing any pages)
- DWQA Plugin filters not working for logged in users
- WP Supersized: Insert zero in front of one digit slider numbers
- Add comment feature to woocommerce Shop page
- Save Email after login with ldap
- register_setting – validation callback weirdness
- Can someone please help me find a solution to my youtube embed problems? [duplicate]
- Dave’s WordPress Live Search only works when logged in as admin
- Google adsense stats plugin? [closed]
- Image Layout in Posts
- How do I copy files I downloaded from the wayback machine to my new site?
- Open all PDF or docx link as iframe
- Increased max_upload_filesize, but still can’t upload plugin [closed]