do_action_ref_array( 'generate_rewrite_rules', WP_Rewrite $wp_rewrite )

Fires after the rewrite rules are generated.


Parameters

$wp_rewrite WP_Rewrite
Current WP_Rewrite instance (passed by reference).

Top ↑

More Information

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


Top ↑

Source

File: wp-includes/class-wp-rewrite.php. View all references

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


Top ↑

Changelog

Changelog
Version Description
1.5.0 Introduced.

Top ↑

User Contributed Notes

  1. Skip to note 1 content
    Contributed by Steven Lin

    Example migrated from Codex:

    An example of adding new endpoint to Rewrite Rules.

    function 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;
        return $wp_rewrite->rules;
    }
    
    add_filter( 'generate_rewrite_rules', 'site_custom_endpoint' );

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