Pagination broken by naming conflict between CPT and Page

You can add a rewrite rule to override the post type rules and force it to load your page. function wpd_fix_insights_pagination(){ add_rewrite_rule( ‘insights/page/([0-9]+)/?$’, ‘index.php?pagename=insights&paged=$matches[1]’, ‘top’ ); } add_action( ‘init’, ‘wpd_fix_insights_pagination’ ); Visit your Settings > Permalinks admin page after adding this code to flush rewrite rules.

Adding a rewrite rule to page that has no fixed variables and pagination

Got it to work, changing the regex from (.+) to (.*) Maybe helpful for others searching same rewrite on search and pagination. add_rewrite_rule(‘discover/interiors/interior-results/(.*)/page/([0-9]{1,})/?’, ‘index.php?pagename=discover/interiors/interior-results&tag1=$matches[1]&paged=$matches[2]’, ‘top’ ); add_rewrite_rule(‘discover/interiors/interior-results/(.*)’, ‘index.php?pagename=discover/interiors/interior-results&tag1=$matches[1]’, ‘top’ );

pagination on data fetched using SQL query

<?php global $wpdb; // QUERY HERE TO COUNT TOTAL RECORDS FOR PAGINATION $total = $wpdb->get_var(“SELECT COUNT(*) FROM (SELECT * FROM muslim LIMIT 0,431) AS a”); $post_per_page = 10; $page = isset( $_GET[‘cpage’] ) ? abs( (int) $_GET[‘cpage’] ) : 1; $offset = ( $page * $post_per_page ) – $post_per_page; // QUERY HERE TO GET OUR … Read more

Wp pagination for custom database table

Add this code to your functions.php file: $customPagHTML = “”; $query = “SELECT * FROM custom_table”; $total_query = “SELECT COUNT(1) FROM (${query}) AS combined_table”; $total = $wpdb->get_var( $total_query ); $items_per_page = 4; $page = isset( $_GET[‘cpage’] ) ? abs( (int) $_GET[‘cpage’] ) : 1; $offset = ( $page * $items_per_page ) – $items_per_page; $result = … Read more

Pagination on custom post type not working if permalinks set to rewrite url

This issue was reported here : https://core.trac.wordpress.org/ticket/15551 It comes from the redirect_canonical() WP function. Try to disable canonical redirect for your custom post type to get pagination work : add_filter( ‘redirect_canonical’,’custom_disable_redirect_canonical’ ); function custom_disable_redirect_canonical( $redirect_url ){ if ( is_singular(‘your_custom_post_type’) ) $redirect_url = false; return $redirect_url; } Hope that helps.

Pagination 404s on custom query

There are a couple of things I don’t understand here, but I’ll try answering them as I go along. You have a home.php, which I assume is your default homepage. You have one line of code in there, and that is to call a another page template. Here is you code <?php require dirname( __FILE__ … Read more

How to customize pagination links?

I’m not going to copy and paste someone else’s code and explain how to.. just a 5 minute search on google “customize pagination WordPress demo” result: Great tutorial of how to set pagination I think this is exactly what your looking for.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)