Problem: The custom post archives set up by WordPress include paginated URLs like:
@http://yoursite.com/psychologists/
@http://yoursite.com/psychologists/paged/2/
@http://yoursite.com/psychologists/paged/3/
However, the WordPress Archive I am using to display these posts is not paginated. Now these URLs contain the same content, which is bad for SEO. I would like to set my WordPress URL pagination so that these URLs do not exist if they are not needed.
Solution:
Modify the pagination settings programmatically like so:
function change_posts_per_page_in_archive( $query ) { if ( is_post_type_archive('book') ) { $query->set( 'posts_per_page', 100 ); } } add_action( 'pre_get_posts', 'change_posts_per_page_in_archive', 999 );
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | - | - |
13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | - | - |
Supporter timezone: America/New_York (GMT-04:00)
This topic contains 4 replies, has 2 voices.
Last updated by 6 years, 6 months ago.
Assisted by: Christian Cox.