WordPress.org

Support

Support » How-To and Troubleshooting » Should I report this as a bug? wp_publish_post

Should I report this as a bug? wp_publish_post

  • As I’ve never reported a bug before I thought I’d ask if this is something that should be submitted.

    wp_publish_post() does not check to make sure there is a post_name (slug).

    As draft posts do not need a slug, if a draft (without a name) is created using wp_insert_post() and then published using wp_publish_post(), you end up with a post with no name.

    Therefore, wp_publish_post() should check if the post has a name, if not use sanitize_title() on the title and update the post with the new name.

    Not sure if this kind of thing counts as a bug because when saving a draft in the core admin panel a slug is created automatically. But for plugin developers this could cause a small problem.

    Should this kind of thing be submitted as a bug, or should people just run their own checks before updating from draft to publish?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Should I report this as a bug? wp_publish_post’ is closed to new replies.