What is the proper way to use add_rewrite_rule to remove the (question mark)? What is the proper way to use add_rewrite_rule to remove the (question mark)? wordpress wordpress

What is the proper way to use add_rewrite_rule to remove the (question mark)?


try

add_action( 'init', 'addMyRules' );function addMyRules(){    add_rewrite_rule('^people/([^/]*)/?','index.php?name=$matches[1]','top');    add_rewrite_tag('%name%','([^&]+)');}


You should call add_rewrite_rule in the action hook as follows:

add_action('init', 'wpa8715_intit');function wpa8715_intit() {    add_rewrite_rule('^people/([^/]*)/?','index.php?name=$matches[1]','top');    add_rewrite_tag('%name%','([^&]+)');}