Should I report this as a bug? wp_publish_post (2 posts)

  1. granrojo
    Posted 6 years ago #

    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?

  2. esmi
    Forum Moderator
    Posted 6 years ago #

    It's a known "feature". :-)

Topic Closed

This topic has been closed to new replies.

About this Topic