Custom Rewrite Rules Not Sticking

I am not completely sure why this happens but I have seen it too. In my plugin Opera Speed Dial Preview I had to add the rewrite rules on init too – that fixed it. Sometimes other plugins or later visits to the permalink page may reset your custom roles … reminds me to write … Read more

htaccess rewrite conflict with wordpress rules and ssl

Edit your existing code to exclude the index.php from redirecting like this: RewriteCond %{HTTPS} on RewriteCond %{REQUEST_URI} !^/info/ RewriteCond %{REQUEST_URI} !^/index\.php$ RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,QSA,L] For an explanation, check the answer to this question at Stackoverflow: Issue with .htaccess redirecting all pages to HTTPS except one .

Add rewrite rule to permalink structure

1. Add a new rewrite rule: add_action(‘init’, function() { add_rewrite_rule(‘^dog/([^/]+)/?$’, ‘index.php?cat=dog&name=$matches[1]’, ‘top’); }, 10, 0); 2. Filter the post link: add_filter(‘post_link’, function($post_link, $post, $leave_name = false, $sample = false) { if ( is_object_in_term($post->ID, ‘category’, ‘DOG’) ) { $post_link = str_replace($post->ID . ‘-‘, ”, $post_link); } return $post_link; }, 10, 4); Try it in your functions.php. … Read more

How to check if a rewrite rule exists

If I understand correctly then you can hook into the rewrite api/process and flush or manipulate the rules that way? Read: Plugin Hooks on this page http://codex.wordpress.org/Function_Reference/WP_Rewrite Maybe something like: // flush_rules() if our rules are not yet included function my_flush_rules() { $rules = get_option( ‘rewrite_rules’ ); if ( ! isset( $rules[‘(project)/(\d*)$’] ) ) { … Read more

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’);

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