Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

post_name is not stored until post is published… where should I store my slug until it goes live then?

When you use the graphical interface, post_name is stored in the wp_posts table even for draft posts as soon as you modify the default value.

I tried your code (case 2) and I actually see the new entry in the database, with the correct post_name. Perhaps your check to post_name is not correct ?

Related Posts:

  1. Change slug with custom field
  2. Where is the old post permalink slug stored?
  3. Use category base slug in posts’ permalink
  4. How to automatically generate a unique random slug
  5. Post slugs and images cannot have same name?
  6. Change the Slug of Post Type post to baseurl/post/%postname%
  7. How to control which category will be picked for the slug of a post?
  8. Bulk update post slugs through database
  9. How to handle broken links created by permalink/slug changes?
  10. Visting slug for ‘post’ post type shows 404 not archive?
  11. how do i add posts-page slug before posts slug in permalinks
  12. Custom permalink for each post
  13. Private post caught in endless redirect loop
  14. How to 301 redirect from url with post id to permalink with post name (slug)?
  15. My post permalinks are always the same
  16. Custom Permalink Structure for Pages & Posts
  17. Change post author without using wp_update_post()
  18. if in category but only with post meta
  19. my post slug gets really long and I can’t change it
  20. Replace image name on upload to the new post name on front-end form
  21. Edit the post title from the frontend
  22. custom word in custom permalink structure
  23. wp_query with ajax
  24. Update post meta within save_post action
  25. Display post number by category
  26. Updating post meta for checkbox
  27. Saving Post Data in Another Database
  28. Show custom post with custom categories with specific slug
  29. register_post_type permalink
  30. Updating permalink structure using ‘post_link’ filter results in 404 error for posts
  31. Post is blank when I click on the link
  32. How can I tell if a post has been published at least once?
  33. Is there a way getting post fields using `transition_post_status`
  34. Automatic blog page with custom design [closed]
  35. Auto update post title and slug when post status is changed
  36. Add multiple meta keys to a post at once
  37. Show number of posts by logged in user
  38. How does WP decide how to display a page
  39. Unabled to Change Permalinks – Even Using the “Edit” (Resets to Original Permalink on “Update”)
  40. Post/page title to permalink transformation – what is behind the scenes?
  41. When sending a newsletter -not with wordpress- the server has 100% cpu [closed]
  42. Retrieve data from post meta meta_key having ‘_product_fq_image’ while having author_id and post type is PRODUCT
  43. Insert data from custom created PHP page into wp_postmeta table
  44. When WP_Query only returns 1 post, how do I automatically redirect to that post?
  45. post type slug vs page slug
  46. Adding a meta box to determine the sidebar [closed]
  47. The loop starting at a certain ID
  48. saving/reading custom field value does not work – no value gets POSTed
  49. Simple Custom Metabox Not Saving
  50. Post titles and thumbnails as links to custom post types?
  51. Internal linking to posts permalink fail because of spaces and stripe at postname
  52. Get post category as a separate string and url
  53. Link post images to post
  54. Making posts permalinks consistent numbers
  55. Can Permalink structure of %postname%/%post_id% improve performance
  56. How to link post titles on page A to its posts on page B?
  57. Problems with WordPress in subfolder, posts show a blank page
  58. how to create a sub section in posts
  59. Categories Listing and Highlighting current category item
  60. Standalone form does not post to the url when form fields are populated (otherwise it does)
  61. Changing permalink of WordPress
  62. Rewriting blog permalinks
  63. Set Default Post as Parent Child (Nested) Relation
  64. How can I add random alphabets in wordpress permalink posts structure
  65. Change permalinks for posts & for custom post types
  66. Remove subcategory slug from url
  67. Featured Images most often doesnt appear
  68. Can I show category name in url for only one of my categories?
  69. Post meta not working
  70. How to bulk Update URLs to new values?
  71. Select another post in a post meta like a parent page is selected while editing a page
  72. SQL DELETE multiple post_meta on single and multi-sites
  73. Permalink Short code showing unnecessary link text inside the loop
  74. Please help a newbie with blog page issue?
  75. Get post slug and match with menu item slug to change css
  76. My post permalinks are redirecting to the post archive page for some reason?
  77. How can I make a post sub link?
  78. How do you change the permalink for posts for a single category?
  79. How to retrieve all meta data directly from the $post object? Such as $post->related_topics?
  80. How to set the post permalink using the WordPress REST API?
  81. What is proper filter or hook action to add data to the $post object?
  82. Does having category name in permalinks affect SEO when having a post in multiple categories?
  83. WP posts using index.php instead of single.php
  84. How to add a ‘News’ section to specific posts in WordPress
  85. unable to display two post per page in wordpress front-page.php
  86. Add a url parameter to the current post and read it in a shortcode
  87. Blogposting Schema & Structured Data without plugin
  88. Automatically select template based on query string for New Posts
  89. Display Updated Date Instead of Published Date
  90. How can I set the permalink of an article / page equal to the permalink of an existing article / page?
  91. How do you update post date (year only) in a separate custom field?
  92. Add postmeta to all blog posts
  93. Prevent Archive URLs
  94. Custom Post Types and Broken Permalinks
  95. Bulk Post update_post_meta
  96. Re-order Category Meta-data
  97. Slug collision between page, taxonomy and custom post type
  98. Custom permalink for wordpress page / post
  99. Word /blog/ in slug post, problems in CPT. Solutions?
  100. Permalink structure for two seperate blogs
Categories posts Tags permalinks, post-meta, posts, slug
Pagination doesn’t work on static front page
Sort by meta key within same day

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress