0

I’ve recently noticed a strange problem with my posts. When creating a new post, and when the post autosaves before publishing, it will automatically get a wrong permalink format.

So instead of: Myweb.com/category/my-new-post

For some reason, and randomly, it will get a permalink like this: Myweb.com/category/355654 (which is the id of the post)

Upon saving and publishing the post, the wrong permalink format remains.

But here is the strange part. If you open the link to read the article, it will show you an older post.

I have checked to see if there is a connection somehow between the new and old post, but couldnt find anything.

Can someone please explain what happens?

2
  • Did you flush permalinks?, you can do that by going into settings -> permalinks and saving. You can also check that you have the correct permalink structure selected. Mar 14 at 7:29
  • Yes, i re-saved the permalinks settings multiple times but still this issue happens randomly. The structure i'm using is: /%category%/%postname%/ Mar 14 at 7:33

1 Answer 1

0

1. Flush your permalinks by going to "Settings" > "Permalinks" and click Save.
(I realized you already did this, but others may not have)


2. If running Apache, check that .htaccess matches this:

# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

3. If Apache check the mod_security module. Your can disable the mod_security module from the cPanel interface. If you are unable to locate the module or don't have access, request your web host to disable mod_security. Clear cache and then try your permalinks again and see if that cleared the issue. Once done, re-enable mod_security.


4. Disable all plugins and switch to a standard WordPress theme (such as Twenty Twenty-Two). Clear cache and check your permalinks. If this resolved the issue, re-enable your theme and plugins 1-by-1 to check for possible causes.


5. While it may be odd, the following does work occasionally:
Within your dashboard go to: "Settings" > "Permalinks". Then select “Custom Structure”. Inside the input field, enter:

/%category%/%postname%/

Click "Save", clear your cache and check your permalinks.


6. If Apache, you may not have mod_rewrite enabled. If you have console access, you can enable it by entering:

sudo a2enmod rewrite

When done, don't forget to restart Apache. ;)

service apache2 restart

7. Check your override rules. Depending on your config, it will be located in one of these files: apache2.conf, http.conf, or 000-default.
Under Directory /var/www/ change Override None to Override All

Good Luck!

2
  • 1
    Hello. Are the above fixes for the specific issue or in general for permalink issues? Have you seen this before, when the permalink does not save properly and the link opens an older post? Mar 14 at 13:16
  • Well, that is what is trying to be resolved. I gave the steps associated with your issue. Unfortunately the question that you asked was very broad and so I provided the steps that should be taken to resolve the issue. Just go 1-by-1 until the issue is resolved.
    – mrwp.io
    Mar 14 at 14:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.