• Hi folks.
    I am tweaking a plugin that inserts posts through a query.
    I have been able to insert title, date, the ‘draft’ status, but I realised that the post_name and guid field are not automatically generated. I suspect that there are a function to generate this fields from the title and ID, but I could not find them in the wp code.
    Can you help me?

Viewing 1 replies (of 1 total)
  • sanitize_title() generates the post_name from either the post name field or the title field, depending on what you pass to it.

    You’ll also need to check the database to ensure that the post_name you’re adding is unique, since it’s often included in the URL. If it’s not, you’ll need to do some clever things with adding suffixes.

Viewing 1 replies (of 1 total)
  • The topic ‘Generating post_name and GUID value’ is closed to new replies.