admin管理员组文章数量:1323190
I am stuck having to use an older plugin, which is no longer maintained. The problem i'm facing is that in WordPress 5.5, the pagination that plugin uses, breaks. All you see is the first page.
This is the code for pagination it uses:
<?php
if ($data['total_pages'] > 1)
{
$add_args = $data['search'];
unset($add_args['paged’]);
echo '<p class="parariusoffice-pagination">' .
paginate_links(array(
'total' => $data['total_pages'],
'current' => $data['paged’],
// maybe include this: get_option('permalink_structure')
'base' => rtrim(get_page_link(get_the_ID()), '/') . '/%#%/',
'add_args' => $add_args
)) .
'</p>';
}
?>
<?php endif; ?>
I have found that changing the permalink structure in the WordPress settings has no effect on this error.
I found this information on permalinks: / , but I am unable to make it work.
How can I make pagination work in this plugin?
Edit: I have found that the main cause is that WordPress no longer allows paginated urls like: /aanbod-panden/2/?order=online_date%3Ddesc It was suggested here: to change the numeric values at the end of the url /aanbod-panden/2/ to /aanbod-panden/?2/
Any suggestions on how to accomplish that in the above plugin code are more than welcome!
I am stuck having to use an older plugin, which is no longer maintained. The problem i'm facing is that in WordPress 5.5, the pagination that plugin uses, breaks. All you see is the first page.
This is the code for pagination it uses:
<?php
if ($data['total_pages'] > 1)
{
$add_args = $data['search'];
unset($add_args['paged’]);
echo '<p class="parariusoffice-pagination">' .
paginate_links(array(
'total' => $data['total_pages'],
'current' => $data['paged’],
// maybe include this: get_option('permalink_structure')
'base' => rtrim(get_page_link(get_the_ID()), '/') . '/%#%/',
'add_args' => $add_args
)) .
'</p>';
}
?>
<?php endif; ?>
I have found that changing the permalink structure in the WordPress settings has no effect on this error.
I found this information on permalinks: https://developer.wordpress/reference/functions/paginate_links/ , but I am unable to make it work.
How can I make pagination work in this plugin?
Edit: I have found that the main cause is that WordPress no longer allows paginated urls like: /aanbod-panden/2/?order=online_date%3Ddesc It was suggested here: https://core.trac.wordpress/ticket/51001 to change the numeric values at the end of the url /aanbod-panden/2/ to /aanbod-panden/?2/
Any suggestions on how to accomplish that in the above plugin code are more than welcome!
Share Improve this question edited Aug 28, 2020 at 9:07 ErwinV asked Aug 24, 2020 at 10:31 ErwinVErwinV 213 bronze badges 3 |1 Answer
Reset to default 1I finally found a solution.
Disable the redirect canonical function with:
add_filter( 'redirect_canonical', '__return_false' );
And fix the 404 error that results from disabling the redirect canonical with this suggestion
本文标签: Wordpress 55 breaks pagination in an older plugin
版权声明:本文标题:Wordpress 5.5 breaks pagination in an older plugin 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742126438a2421964.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
$data['total_pages']
come from? I don't think WordPress sets it, even before 5.5. – Rup Commented Aug 24, 2020 at 10:42