I produced a wordpress plugin... I personally use my custom variable within this wordpress plugin and I wish to rewrite this url for Search engine optimization, however i can't. Basically make use of the Permalink generator of WordPress, then rewrite is figure, but when I wish to make use of the offical codes during my wordpress plugin for rewrite it does not work.

Here you go an easy code what's not work. I do not no why.


// Remember to flush_rules() when adding rules
function flushRules(){
    global $wp_rewrite;

// Adding a new rule
function wp_insertMyRewriteRules($rules)
    $newrules = array();
    $newrules['(project)/(\d*)$'] = 'index.php?pagename=$matches[1]&id=$matches[2]';
    return $newrules + $rules;

// Adding the id var so that WP recognizes it
function wp_insertMyRewriteQueryVars($vars)
    array_push($vars, 'id');
    return $vars;

function search_url_rewrite_rule() {
if ( is_search() && !empty($_GET['s'])) {
wp_redirect(home_url("/search/") . urlencode(get_query_var('s')));
add_action('template_redirect', 'search_url_rewrite_rule');

I authored a brand new code into my wordpress plugin, however it hasn't effect:

add_action('admin_init', 'flush_rewrite_rules');

add_action('generate_rewrite_rules', 'geotags_add_rewrite_rules');
function geotags_add_rewrite_rules( $wp_rewrite ) 
  $new_rules = array( 
     'p/(.+)' => 'index.php?p=' .
       $wp_rewrite->preg_index(1) );

  // Add the new rewrite rule into the top of the global rules array
  $wp_rewrite->rules = $new_rules + $wp_rewrite->rules;

perhaps you have attempted searching only at that page


and i believe you need to flush the guidelines each time..