Do a test on the page-url.php page
functions.php Join
Add_filter (' Rewrite_rules_array ', ' my_insert_rewrite_rules '); Add_filter (' Query_vars ', ' my_insert_query_vars '); Add_action (' wp_loaded ', ' my_flush_rules ');//When WP loads, run the My_flush_rules method//If there is no rule in the pseudo-static rule, reset function my_flush_ Rules () {$rules = get_option (' rewrite_rules '); Gets the option data table ' Rewrite-rules ' if (!isset ($rules [' url-(. *). html '])) {global $wp _rewrite; $WP _rewrite->flush_rules ();}} Add a new pseudo-static rule function My_insert_rewrite_rules ($rules) {$newrules = array (); $newrules [' url-(. *). html '] = ' index.php? Pagename= $matches [0]&v= $matches [1] '; return $newrules + $rules;} Add a variable name function My_insert_query_vars ($vars) {Array_push ($vars, ' V '); return $vars;} echo $wp _query->query_vars[' V ']; Write to the place where you want to get the pass value
After saving, enter localhost/wordpress/url-123.html in the browser address bar;
Attached:Some parameters of wordpress fixed link settings
- %year%: Based on the year the article was published, such as 2010;
- %monthnum%: Based on the month of the article release, such as 01;
- %day%: Based on the date of the article release, such as 06;
- %hour%: Based on the article published hours, such as 23;
- %minute%: Based on the article release minutes, such as 43;
- %second%: Based on the post number of seconds, such as 33;
- %postname%: An article-based postname whose value is the abbreviated name specified at the time of writing, and the title of the article without specifying a thumbnail name;
- %post_id%: Based on article post_id, such as 48;
- %category%: Based on the classification of articles, sub-classifications are processed into the form of "classification/sub-classification";
- %author%: Based on the author name of the article.
WordPress Learning (iv)---URL pseudo-static simple understanding