We help IT Professionals succeed at work.
Get Started

Why is WordPress creating permalinks with -2 at the end when no duplicate exists?

ChrisGreenhough
on
73 Views
Last Modified: 2016-02-27
Working on a WordPress site that is pulling post data from a third party system via an externally triggered Cron. Everything seems to be working absolutely fine, except that as posts are being created each post slug has -2 appended as if there were already a post with the same name - except there isn't. This doesn't always happen, however. If I zero the post tables in the db and run the custom post import plugin, everything is fine to begin with.

I had a feeling it might be something to do with being logged into the back end when the Cron task runs, but I can't prove this and am not sure where else to look for the issue or the solution.

Tried adding "if ( ! current_user_can( 'edit_posts' ) )" before the import function runs, but this didn't seem to cure it. Not sure how to proceed so any help appreciated.

Many thanks.

P.S. I'm not really a WordPress developer, more a designer who dabbles :)
Comment
Watch Question
PHP Web Developer
Commented:
This problem has been solved!
Unlock 2 Answers and 4 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE