Any tag pagination page (except the 1st page) loads index.php template instead of tag.php

Overall CODE issues: Your CODE is so wrong in so many ways that I shouldn’t even attempt to address them here. I suggest you study Official WordPress Theme Handbook properly before doing these sort of customizations. For the sake of the context, I’m ignoring other issues within your CODE and touching only the issues below: … Read more

Pagination links not showing on custom post type admin list

“Posts per pages” limit from “Settings -> Reading” does not apply here (post list in the dashboard) and default size of list is 20. Your pagination does not work properly because you use pre_get_posts action hook to change the per_page limit, which is not the right way. The per_page limit overwritten by pre_get_posts filter will … Read more

wordpress Next/Previous post in same category not working

I use the following code to Displays Next/Previous link in same posts category and work correctly for me. <?php get_template_part( ‘content’, get_post_format() ); // Previous/next post navigation. previous_post_link(‘%link”https://wordpress.stackexchange.com/questions/344307/,”Before’, true ); next_post_link( ‘%link”https://wordpress.stackexchange.com/questions/344307/,”Next’, true ); ?> And For CSS Styling the “%link” Element I use this code in my functions.php file. /////Next/Prev post style add_filter(‘next_post_link”https://wordpress.stackexchange.com/questions/344307/,”next_post_link_attributes’); add_filter(‘previous_post_link”https://wordpress.stackexchange.com/questions/344307/,”previous_post_link_attributes’); … Read more

In pagination, change link for page 1 to homepage

You can do a simple str_replace( ‘/page/1/’, “https://wordpress.stackexchange.com/”, $string ) on the results generated by paginate_links() to get rid of /page/1/ which appears on the first page link as well as the Prev link (when it points to the first page). Here’s a full (tested) example: /** * Numeric pagination via WP core function paginate_links(). … Read more

Redirect “any page/page/number/” to “any page”

I’d like to redirect in ht.access To clarify, it’s .htaccess, not ht.access. You can do something like the following at the top of the .htaccess file, before the existing WordPress directvies: RewriteRule (.*/)page/\d+/?$ /$1 [R=302,L] The above issues a 302 (temporary) redirect for any URL of the form /<something>/page/<number>/ (trailing slash optional) to /<something>/. The … Read more

Having issues with wordpress pagination with multiple categories

I did more research and found a plugin that corrects the pagination issues with multiple categories. To summarize, I am using using a plugin called WordPress Category Archive – www.wordpress.org/extend/plugins/wp-category-archive/ to display my category specific archive. There were some issues with pagination due to the year/month being included in the url. The Solution: A plugin … Read more

Getting 404 on taxonomy page

I’ve solved this for myself with rewrite rule. The story: I have “piece” custom post type, taxonomy “media_tag” with “m_audio” term and taxonomy “genre_tag” with “g_sacred”, “g_folk” etc. And I want to have an URL like /piece/audio/<genre> to access archives. So, now I have in my functions.php: add_filter( ‘rewrite_rules_array’, ‘my_insert_rewrite_rules’ ); function my_insert_rewrite_rules( $rules ) … Read more