Regex in add_rewrite_tag not accepting OR operators?

I don’t know what’s wrong but I can suggest: Use Rewrite Rules Inspector or similar to see where your %psubject% rule is and if its pattern ((option1|option2|option3)) has been added correctly. Test http://example.com/somecategory/option1/this-is-the-post-title with the Inspector to see which rule matches. Open http://example.com/somecategory/option1/this-is-the-post-title (when it shows home.php) with the Debug Bar plugin and look at … Read more

Rewrite rule page url with category

Just of the top of my head, something along this way might work: function wpse178647_rewrite() { add_rewrite_rule( ‘^([^/]+)/([^/]+)/?$’, ” ‘index.php?category_name=$matches[1]&pagename=$matches[2]’, ‘top’ ); } add_action( ‘init’, ‘wpse178647_rewrite’ ); Completely and utterly untested.

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

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