Need help with rewrite_rules_array

Try this: function when_rewrite_rules( $wp_rewrite ) { $new_rules = array(); $new_rules[‘category/tasks/(\d*)$’] = ‘index.php?when=$matches[1]’; $wp_rewrite->rules = $new_rules + $wp_rewrite->rules; } add_filter(‘generate_rewrite_rules’,’when_rewrite_rules’);

rewrite_rule() not preserving the query string

If faculty is a child page of meetings, the rule should be: add_rewrite_rule( ‘meetings/faculty/([^/]+)/?$’, ‘index.php?pagename=meetings/faculty&hash=$matches[1]’, ‘top’ ); pagename=meetings/faculty instead of p=1598 EDIT- or alternately: add_rewrite_rule( ‘meetings/faculty/([^/]+)/?$’, ‘index.php?page_id=1598&hash=$matches[1]’, ‘top’ ); page_id=1598 instead of p=1598

WordPress URLs without posts

Yes, it is possible. WordPress frontend workflow can be summarized like so: A url is visited By checking current url against all the defaults and custom rewrite rules the url is “converted” to a set of arguments for WP_Query. This is done by the parse_request method of an instance of the WP class stored in … Read more

How to remove “admin.php?page=” from wp-admin using .htaccess?

You can try this (sorry, not previously tested). See comments inline for explanation: RewriteEngine On ## if any string separated by | is matched, it will append to ?page= RewriteRule ^(members|add-members|delete)$ admin.php?page=%1 [L,E=CLEAN_CONTACT_URL:1,QSA] ## If querystring starts with page= and is followed by any string separated by | ## put that in the first group. … Read more

add_query_vars and add_rewrite_rules

You can see in this answer how add_rewrite_rules is being used, I don’t think it applies to your case at all. What you need to do is to redirect urls generated from the search from (I’m assuming something like site.com/?s=term) to a pretty URL. This article do it http://www.wptavern.com/how-to-make-the-wordpress-search-url-pretty

How do i change the search permanent links

This snippet should solve your problem. Just put it into your functions.php file. function my_insert_rewrite_rules( $rules ) { $newrules = array(); $newrules[‘search/([^/]+)/post_type/([^/]+)/?$’] = ‘index.php?s=$matches[1]&post_type=$matches[2]’; return $newrules + $rules; } add_filter( ‘rewrite_rules_array’,’my_insert_rewrite_rules’ ); function my_flush_rewrite_rules() { flush_rewrite_rules(); } add_action( ‘after_switch_theme’, ‘my_flush_rewrite_rules’ ); You will have to flush rewrite rules after adding this code, before it will … Read more

Rewrite url for custom post type

this will not work: ‘en/index.php?post_type=vinos’ there is no en/index.php, it has to be: ‘index.php?post_type=vinos’ if you need to detect en in the path, add a query var, then set that query var in your rewrite: function wpa_query_vars( $qvars ) { $qvars[] = ‘wpa_lang’; return $qvars; } add_filter( ‘query_vars’, ‘wpa_query_vars’ ); then in your rewrite rule: … Read more

Using plus (+) sign instead of space (-) in WordPress URL

This isn’t possible without modifying a core file. The function WordPress uses for this is called sanitize_title_with_dashes You can find it in wp-includes/formatting.php on It doesn’t offer any filters, so you will need to make a change to this line: $title = str_replace( array( ‘%c2%a0’, ‘%e2%80%93’, ‘%e2%80%94’ ), ‘-‘, $title ); I wouldn’t recommend modifying … Read more

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