Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter ppo

    (@ppo)

    Thank you @bcworkz and @shayde22 for your answers.

    TL;DR: (for reference)
    Q: How can we sanitize_title() outside WP the same way WP does?
    A: We can’t… because it’s a WP hook/filter, so plugins can intervene.

    • This reply was modified 2 years, 9 months ago by ppo.
    Thread Starter ppo

    (@ppo)

    Thank you @shayde22 but that’s a short-sighted approach.
    The objective is not to do “something similar” but to do “always exactly the same thing”; if not, the URL is wrong and therefore not working. That’s extremely important, otherwise everything else was useless.
    (Like you do a very long trip to paradise… but you took the wrong key for the entrance gate. You may not take just any key.)

    When you dig into the sanitize_title() code, you see: remove_accents() and apply_filters() that “Calls the callback functions that have been added to a filter hook.” What are these exactly doing? It’s a hook, related to plugins. Can they step in and change the value? For example, can an SEO-related plugin decide to remove the unnecessary “the” or “of”? How do they handle 's? Etc.

    I don’t find there the code where the conversion to “-” is done. So it’s hidden in one of the filters. What else is hidden in there?

    • This reply was modified 2 years, 9 months ago by ppo.
    • This reply was modified 2 years, 9 months ago by ppo.
    Thread Starter ppo

    (@ppo)

    Thank you for your answer.
    I think there are some misunderstandings. I don’t want to create/insert new posts in WP. I generate XML files that I send to the WP guys who import them. They’ve already setup the permalink structure in WP and everything is fine there. I just need to be able to generate the exact same permalink on my own.

    I didn’t mention that but currently the XMLs are generated BEFORE the data are actually in WP. So I can’t even read the WP DB.

    I could 🫤🙄 generate the SiteX XML after the data have been imported in WP… but is the final/definitive URL of the post stored in the DB? Do you know where it’s exactly stored?

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