• I think than your plugin is superb, but need a little add-on.

    I change your Flush rules button, because I think is not necessary, almost for me :-(. I change it for Restore default, to get the default rewrite rules of WordPress and start again with new rules. I think than this is necessary because when the plugin is active there’s not option to do this, without deleting the rewrite_rules_save in wp_options table.

    To do this I just add a line to this code:

    if(isset($_POST['rule-flush'])) {
    				$wp_rewrite->flush_rules();
    				$message = 'Rule flushed.';
    			}

    And change with this:

    if(isset($_POST['rule-flush'])) {
    				$wp_rewrite->flush_rules();
    				update_option( 'rewrite_rules_save' , $wp_rewrite->wp_rewrite_rules() );
    				$message = 'Rule flushed and restored.';
    			}

    And change this line:
    <input id="rule-flush" name="rule-flush" type="submit" class="button" value="Flush rules"/>

    With this one:
    <input id="rule-flush" name="rule-flush" type="submit" class="button" value="Restore default"/>

    Please add something like this in the futures updates.

    Thank’s a lot for your great job.

    http://ww.wp.xz.cn/extend/plugins/rewrite/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter Art Project Group

    (@artprojectgroup)

    This add-on only work when Disable rewrite is active ;-).

    Thanks a lot! I updated my permalink structure and couldn’t get it back to the original. This solved it. Hope this gets implemented in the future.

    Thread Starter Art Project Group

    (@artprojectgroup)

    🙂

    The developer hasn’t updated the plugin in so long. Maybe Emilo could release a plugin inspired by this one?

    Emilo, which file do i edit? I don’t see the code the first code you want us to replace.

    This is missing:

    if(isset($_POST['rule-flush'])) {
    				$wp_rewrite->flush_rules();
    				$message = 'Rule flushed.';
    			}

    Thread Starter Art Project Group

    (@artprojectgroup)

    The file is rewrite.php at line 334.

    I’ll study the creation of a new version of this superb plugin, but I think that isn’t necessary with this little add-on.

    oh ok. the line your talking about has the stipulation of “false” in it.
    Do we insert or leave out “false” in the replacement code?

    Here’s the code that is currently in the plugin:

    if(isset($_POST['rule-flush'])) {
    $wp_rewrite->flush_rules(false);
    $message = 'Rule flushed.';
    Thread Starter Art Project Group

    (@artprojectgroup)

    When I made the add-on, the false was not there 😉

    In http://codex.ww.wp.xz.cn/Rewrite_API/flush_rules says:

    Arguments

    $hard
    (boolean) (optional) Whether to update .htaccess (hard flush) or just update rewrite_rules option (soft flush).

    Default: true

    I used the code without false and works fine, but try it ;-).

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Restore default rewrite rules’ is closed to new replies.