How to fix pagination after rewriting url? ie. www.site.com/players/type/pro/page/3/

You have to add another rule which maps the /page/# to the &paged=# variable. Really though, you’re kinda doing it all backwards here by filtering the rules array. Just calling add_rewrite_rule to add your rules makes a bit more sense. function plugin_name_add_rewrite_rules() { add_rewrite_rule(‘players/type/([^/]+)/?$’, ‘index.php?post_type=players&type=$matches[1]’, ‘top’); add_rewrite_rule(‘players/type/([^/]+)/page/([0-9]+)?$’, ‘index.php?post_type=players&type=$matches[1]&paged=$matches[2]’, ‘top’); } add_filter(‘init’, ‘plugin_name_add_rewrite_rules’);

Rewrite rule for Custom post type Monthly and Yearly archive

I used this to enable yearly and monthly archive for custom post type. Just drop in this code into your functions.php file. This will add your custom rule right on the top of the Rules array. NB – WordPress uses rules array to store rewrite rules. <?php function wpse22992_custom_post_rewrite( $rewrite_rules ) { $cpslug = ‘contest_recipe’; … Read more

generate_rewrite_rules (action) vs add_rewrite_rule (function): which one is preferred?

They are totally differents: generate_rewrite_rules is an action hook and add_rewrite_rule is a function. That said, use add_rewrite_rule() if you want to define custom rewrite rules. Use generate_rewrite_rules to perform an action (from codex) “after all rewrite rules have been created”. That doesn’t mean that you can not add rewrite rules via generate_rewrite_rules, in fact … Read more

add_rewrite_rule – working fine but broken for pagination

Have you tried: The main one: add_rewrite_rule( ‘region/([^/]+)/type/([^/]+)/?’, ‘index.php?taxonomy=region&term=$matches[1]&post_type=$matches[2]’, ‘top’ ); For pagination add_rewrite_rule( ‘region/([^/]+)/type/([^/]+)/page/([0-9]{1,})/?’, ‘index.php?taxonomy=region&term=$matches[1]&post_type=$matches[2]&paged=$matches[3]’, ‘top’ ); Out of curiousity, I replaced one of the ([^/]+) with the literal ‘type’ since that doesn’t seem to be a dynamic variable. If the pagination doesn’t work, try switching the order of when it’s declared, i.e. before … Read more

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