Skip to main content
WordPress

How to Refresh / Flush WordPress Permalinks

Contents

To flush WordPress rewrite rules or permalinks (usually needs to be done manually for new custom post types) from the admin Dashboard:

  • Step 1: In the main admin menu find "Settings > Permalinks".
  • Step 2: Scroll down if needed and click "Save Changes".
  • Step 3: Rewrite rules and permalinks are flushed.

Flushing rewrite rules in PHP

To flush the permalinks or rewrite rules from your theme or plugin you need to use the flush_rewrite_rules() function.

<?php flush_rewrite_rules(); ?>

If you are not familiar with PHP or writing custom code its best to use the dashboard, this is because you should only flush rules on activation or deactivation of a plugin or theme.

If you flush the rules with any other hooks, you can run into issues since you do not need or want to flush the rules that often.

When To Flush WordPress Permalinks

WordPress permalinks should be flushed when one of the following takes place:

  • You register a post type or taxonomy.
  • You install a new plugin or theme.
  • You add code that affects the WordPress rewrite rules.

Access More TypeRocket

Join our community mailing list and get notified before anyone else. Get videos and more.

By using our website you agree to our Cookie policy.