Code in functions.php limits to only 10 posts that can be shared
-
Hi.
I have this code in my functions.php file, which allows me to limit the posts shown in the grid of the blog home page:
add_action( 'pre_get_posts', 'tu_change_posts_per_page', 1 ); function tu_change_posts_per_page( $query ) { if ( ( ! is_main_query() && ! is_front_page() ) || is_admin() ) { return; } if ( ! $query->is_paged && ! is_front_page() ) { $query->set( 'posts_per_page', 10 ); } }
My theme in generatepress.
This code apparently is incompatible with Revive Old Posts, since it prevents all posts on my website from being shared, limiting them to the last 10 published.
These 10 are the same ones that are defined in the code that passes them before. So if I remove the code from the functions.php its plugin works as expected, and it shares all the posts on my website.
The creator of the code, I wonder if your plugin supports
pre_get_posts
hook?Or could another cause be?
Can you help me with this?
Thank you.
- The topic ‘Code in functions.php limits to only 10 posts that can be shared’ is closed to new replies.