Problem on author pagination pages
-
Hello Anh Tran! I noticed an issue on the author pagination pages. If I want to change part of the title related to the page number on all pagination pages, for example, “Page 2” to something like “Page 2 of 10”, nothing changes on the author pagination pages.
I am using the following code to change part of the title:
add_filter('document_title_parts', function($title_parts) { if (is_paged()) { global $wp_query; $total_pages = $wp_query->max_num_pages; // Get the current page number $paged = get_query_var('paged'); // Set the desired text instead of "Page 2". $title_parts['page'] = 'Page ' . $paged . ' of ' . $total_pages; } return $title_parts; });
For example, I can easily change the title separator on all pages with one line of code:
add_filter('document_title_separator', fn() => '|');
However, I cannot change the part of the title related to the page number on the author pagination pages using the ‘document_title_parts‘ filter. I do not encounter this issue when the plugin is deactivated.
By the way, why isn’t the dynamic variable {{ page }} used in the Meta title of the homepage?
- You must be logged in to reply to this topic.