WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/wp publish post

Description

Publish a post by transitioning the post status.

Note: This function does not do anything except transition the post status. If you want to ensure post_name is set, use wp_update_post() instead.

Usage

<?php wp_publish_post$post_id ?>

Parameters

$post_id
(integer) (required) Post ID.
Default: None

Return Values

(null) 

Examples

Notes

Change Log

Since: 2.1.0

Source File

wp_publish_post() is located in wp-includes/post.php.

Related

Alex King's post on wp_publish_post() vs wp_update_post()


See also index of Function Reference and index of Template Tags.