How to properly rewrite url by custom var

I’ve been trying to rewrite a shop uri, and what I have now is this code: add_filter(‘rewrite_rules_array’,’wp_insertMyRewriteRules’); add_filter(‘query_vars’,’wp_insertMyRewriteQueryVars’); add_filter(‘wp_loaded’,’flushRules’); // Remember to flush_rules() when adding rules function flushRules(){ global $wp_rewrite; $wp_rewrite->flush_rules(); } // Adding a new rule function wp_insertMyRewriteRules($rules) { $newrules = array(); $newrules[‘shop/brand/(brand)/?$’] = ‘shop.php?brand=$matches[1]’ ; //$wp_rewrite->rules = $new_rules + $wp_rewrite->rules; return $newrules + … Read more

What to do Regular expression pattern doesn’t match anywhere in string?

I am trying to match <input> type “hidden” fields using this pattern: /<input type=”hidden” name=”([^”]*?)” value=”([^”]*?)” />/ This is sample form data: <input type=”hidden” name=”SaveRequired” value=”False” /><input type=”hidden” name=”__VIEWSTATE1″ value=”1H4sIAAtzrkX7QfL5VEGj6nGi+nP” /><input type=”hidden” name=”__VIEWSTATE2″ value=”0351118MK” /><input type=”hidden” name=”__VIEWSTATE3″ value=”ZVVV91yjY” /><input type=”hidden” name=”__VIEWSTATE0″ value=”3″ /><input type=”hidden” name=”__VIEWSTATE” value=”” /><input type=”hidden” name=”__VIEWSTATE” value=”” /> But I am not … Read more