I am creating post using wp_insert_post()
. I would like to insert Post URL at that time. How can I do that ?
-
2the URL of a post isn't stored and used in the database, the only thing a post contributes to its permalink/URL is its name/slug, the rest are derived from WP rewrite rules/global permalink settings. Instead of focusing on how to implement this proposed solution and falling into an X Y problem trap, add details about what the problem is that lead you to this, why would you want this, what does it solve? That context is invaluable for solving your problem– Tom J Nowell ♦Commented Apr 3 at 9:35
Add a comment
|
1 Answer
When you are using wp_insert_post()
there is a param post_name
.
If you do not pass it then it will sanitise your post title and update.
You only have control to add post_name
but the full URL is created based on your Permalink settings.