Complex rewrite rules with multiple variables, some the same

For those interested I got around it by doing the following add_rewrite_rule( ‘members/search/(.+?)?$’, ‘index.php?page_id=’ . $member_page_id . ‘&search=$matches[1]’, ‘top’ ); So essentially getting everything after the search then dealing that when parsing the query I then parsed the query like so from the ‘search’ query_var function wpse_set_pre_get_users( $query ){ if( ! is_admin() ){ $meta_query = … Read more

Custom post type rewrite and wp_pagenavi interfering with each other

I solved it. To enable the new rule, save the parmalink structure. Ive tried to follow the example with news from above. function news_page_rewrite_rule() { // Get the URL of the page listing out the news. // Here I use the Advanced Custom Fields plugin. $news_page_url = get_field(‘_news_page’, ‘options’); if (empty($news_page_url)) return; // Get the … Read more

How to use a custom field with add_rewrite_rule()?

You should use ‘post_type_link’ hook and register post type ‘project’ with (‘with_front’ => true) parameters ‘rewrite’ => array(‘slug’ => $slug, “with_front” => true), ==================================or===================================== add_rewrite_rule(‘^project/([0-9a-z]+)/?$’, ‘index.php?project=$matches[1]’, ‘top’); ==================================================================== function post_type_link_hook($link, $post) { add_rewrite_tag(‘%url_id%’,'([^&]+)’); if (‘projects’ == get_post_type($post)) { $urlId = get_post_meta($post->ID, ‘url_id’, true); //Lets go to get the parent cartoon-series name return str_replace(‘%url_id%’, $urlId, $link); … Read more

How to add rewrite rule to point to file

add_rewrite_rule should choose where to write your rules to internal array of rewrite_rules or to .htaccess. If I understand logic behind this code SSLA_PLUGIN_URL is something like http://www.example.com/wp-content/plugins/plugin/… in this case you should check your .htaccess (in case if you using apache), because all external rules goes there. You can continue to debug your redirections … Read more

WordPress URL not working?

This is not how rewrite_rules works in WordPress. You miss two things. Match. It has $1, but in reality (take a look to example), you need to work with $matches. Your Query Var. You using q, but its not wp native or declared in example code. You can use one of the public ones or … Read more

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