Support

Account

Home Forums Bug Reports Post object with taxonomy filter broken after slug has been changed

Solving

Post object with taxonomy filter broken after slug has been changed

    • jase_io

    • November 2, 2018 at 9:33 pm

    Hello,

    I have just come across this snag in ACF Pro.

    We have a Post Object field that is filtered by a taxonomy with the ability to select multiple posts. All good thus far. However the client has updated the taxonomy slug and we have noticed that, when trying to add new posts, the field returns “No results found”.

    Is it not a viable option to use the ID instead of the slug when filtering posts?

    Thanks,
    Jase

  • The only “ID” that a taxonomy has in WP is the slug (or taxonomy name). Taxonomies are not stored in the DB and do not have any other ID value. You cannot change the slug without effecting everything that depends on it. The list of things that this would effect is quite large and I’m sure that if I tried to list them all that I’d miss a few.

    If the goal of doing this was to change the slug shown in the URL string then what should have been changed is the rewrite slug https://codex.wordpress.org/Function_Reference/register_taxonomy

    • jase_io

    • November 6, 2018 at 8:46 am

    Apologies, I didn’t explain that very clearly. We were filtering a taxonomy field by a term. The term slug was changed, after which posts tagged by that term could no longer be picked. My initial thought was that if it was using the term ID, surely it wouldn’t falter when trying to filter posts, even if the slug had been changed?

  • Ah, I see. I see that’s what’s happening. I can’t say why the developer first chose slugs for filtering and I’m guessing that it has been maintained this way for backwards compatibility. If it was changed to IDs not then it would break every post object field. Right now all you can do is edit the field and change the filter to the new term name. You can try contacting the developers here https://www.advancedcustomfields.com/contact/

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.