How do I toggle pagination on/off in search results and category listings via a link?

I think it should work by hooking into pre_get_posts: function wpse_254661_remove_pagination( $query ) { if ( $query->is_main_query() && get_query_var( ‘onepageprint’, 0 ) ) { $query->query_vars[‘nopaging’] = 1; $query->query_vars[‘posts_per_page’] = -1; } } add_action( ‘pre_get_posts’, ‘wpse_254661_remove_pagination’ ); Like this you can modify your query right before it gets fetched and the query object gets passed by … Read more

Newline URL entity when using esc_url()

Background: WordPress strips out %0A from URL because in general newline has no practical purpose in URL. Unless it’s a mailto: protocol, WordPress strips out %0A. So it’s better not to use them in URL at all. Solution: Still, if for any specific purpose you have to use %0A, you may use %250A and then … Read more

Changing WordPress core without hacking core

It is possible to set the site URL manually in the wp-config.php file. Add these two lines to your wp-config.php, where “example.com” is the correct location of your site define(‘WP_HOME’,’http://example.com’); define(‘WP_SITEURL’,’http://example.com’); or Edit Functions.php update_option( ‘siteurl’, ‘http://example.com’ ); update_option( ‘home’, ‘http://example.com’ ); Try this Let me know any issue persist.