• Hi there,

    I was adding my custom post status and, unless I really passed through something important, it seems very difficult to make it have an identical behaviour as the pending/draft ones.

    In wp_insert_post() function, there is no possibility to add a status to the list of status for which postname can be set to empty (no hook, no filter). Then I update the post after that to erase the postname. But it appears the guid is set with the postname too, according to the behaviour of get_permalink() function called in wp_insert_post().

    I think a solution is findable, but it would be much easier if a filter existed on the array( ‘draft’, ‘pending’, ‘auto-draft’ ) each time it is used in wp_insert_post(). Thus we would have the possibility to add our own custom type into this behaviour (no fancy guid and no postname till a custom validation).

    Thanks in advance for your answers!

    Cheers

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter villagora

    (@villagora)

    The solution I used is to upadte the postname to empty on the ‘wp_insert_post’ hook. And to force the guid on the filter ‘post_link’ with the ‘?p=postid’ type permalink.
    Not very pretty but seems to work well.

    Thread Starter villagora

    (@villagora)

    Hi again,

    In the same way, it would be nice to add the $post parameter to the filter ‘display_post_states’ in the ‘_post_states($post)’ function (wp-admin/includes/template.php), in order to add easily a post state according to the status of the post.

    Indeed I currently use the global ‘$post’ to retrieve the post_status in order to know if we have to had a mention according to our own custom post-status. But it would be more correct to have it through the filter argument.

    Regards

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Allowing custom post status with no postname’ is closed to new replies.