Support » Plugins » Hacks » Remotely setting permalinks

  • A client of mine is using a membership plugin that’s, unfortunately, a bit buggy and it messes with the permalinks somehow a few times a day.

    So, we end up with site wide 404 errors.

    I’ve created a script that emails us when this happens, but don’t have a fix from the developers of the plugin yet.

    So to fix it we have to go into the permalinks settings and submit the form.

    Is there a way I can have a script do this remotely? It’ll run on the same server, but I just need to have that form process automatically when 404 errors are noticed.

Viewing 1 replies (of 1 total)
  • Moderator bcworkz


    I don’t have access to my usual resources right now, so I’m sort of guessing here. I believe you should, instead of having your script email you, have the script execute something like this:

    function refresh_permalinks(){
       global wp_rewrite;
       $permalink_structure = '!!! Insert the permalink structure from your form here. !!!';
       $wp_rewrite->set_permalink_structure( $permalink_structure );

    The intent here is to replicate the significant code portion resulting from the form submit, as most of the form does not apply to your situation. Be sure your structure is compatible with the $wp_rewrite method used, the form’s code does some formatting of your form value. Review the code of wp-admin/options-permalink.php around line 94 for more insight.

Viewing 1 replies (of 1 total)
  • The topic ‘Remotely setting permalinks’ is closed to new replies.