Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Difference between revisions of "Rewrite API"

m (Remove link spam)
 
(4 intermediate revisions by 4 users not shown)
Line 1: Line 1:
  +
{{Languages|
  +
{{en|Rewrite API}}
  +
{{ja|Rewrite API}}
  +
}}
  +
 
==Description==
 
==Description==
 
WordPress allows theme and plugin developers to programmatically specify new, custom rewrite rules. The following functions (which are mostly aliases for [[Function_Reference/WP_Rewrite|WP_Rewrite]] methods) can be used to achieve this.
 
WordPress allows theme and plugin developers to programmatically specify new, custom rewrite rules. The following functions (which are mostly aliases for [[Function_Reference/WP_Rewrite|WP_Rewrite]] methods) can be used to achieve this.
   
Note that these rules are usually called inside the init hook. Furthermore, permalinks will need to be refreshed (you can do this from your admin under Settings > Permalinks) before the rewrite changes will take effect. Requires one-time use of flush_rules() to take effect.
+
Note that these rules are usually called inside the <code>init</code> hook. Furthermore, permalinks will need to be refreshed (you can do this from your admin under (Settings > Permalinks) before the rewrite changes will take effect. Requires one-time use of flush_rules() to take effect. See also [[Function_Reference/register_post_type#Flushing_Rewrite_on_Activation|Flushing Rewrite on Activation]].
   
 
==API Reference==
 
==API Reference==

Latest revision as of 11:39, 3 April 2017

Description

WordPress allows theme and plugin developers to programmatically specify new, custom rewrite rules. The following functions (which are mostly aliases for WP_Rewrite methods) can be used to achieve this.

Note that these rules are usually called inside the init hook. Furthermore, permalinks will need to be refreshed (you can do this from your admin under (Settings > Permalinks) before the rewrite changes will take effect. Requires one-time use of flush_rules() to take effect. See also Flushing Rewrite on Activation.

API Reference

Articles

  • Lesson: Rewrite API Overview
  • Class: WP_Rewrite() - An overview of WordPress's built-in URL rewrite class.

Hooks

Functions