do_action_ref_array( ‘generate_rewrite_rules’, WP_Rewrite $wp_rewrite )

Fires after the rewrite rules are generated.

Parameters

$wp_rewriteWP_Rewrite
Current WP_Rewrite instance (passed by reference).

More Information

Triggers after all rewrite rules have been created. The rewrite object is passed as argument by reference.

Source

do_action_ref_array( 'generate_rewrite_rules', array( &$this ) );

Changelog

VersionDescription
1.5.0Introduced.

User Contributed Notes

  1. Skip to note 2 content

    Example migrated from Codex:

    An example of adding new endpoint to Rewrite Rules.

    function wpdocs_site_custom_endpoint( $wp_rewrite ) {
        $feed_rules = array(
    	  'my-account/?$' => 'index.php?account-page=true',
    	  'my-account/edit-profile/?$' => 'index.php?account-edit-profile=true',
        );
    
        $wp_rewrite->rules = $feed_rules + $wp_rewrite->rules;
    }
    
    add_action( 'generate_rewrite_rules', 'wpdocs_site_custom_endpoint' );

You must log in before being able to contribute a note or feedback.