de

wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren


  |     Alle durchsuchen


wp_insert_post [ WordPress Function ]

wp_insert_post ( $postarr, $wp_error = false )
Parameter:
  • array $postarr Elements that make up post to insert.
  • bool $wp_error Optional. Allow return of WP_Error on failure.
Nutzt:
Gibt zurück:
  • int|WP_Error The value 0 or WP_Error on failure. The post ID on success.
Definiert in:



Insert a post.

If the $postarr parameter has 'ID' set to a value, then post will be updated.

You can set the post date manually, but setting the values for 'post_date' and 'post_date_gmt' keys. You can close the comments or open the comments by setting the value for 'comment_status' key.

The defaults for the parameter $postarr are: 'post_status' - Default is 'draft'. 'post_type' - Default is 'post'. 'post_author' - Default is current user ID ($user_ID). The ID of the user who added the post. 'ping_status' - Default is the value in 'default_ping_status' option. Whether the attachment can accept pings. 'post_parent' - Default is 0. Set this for the post it belongs to, if any. 'menu_order' - Default is 0. The order it is displayed. 'to_ping' - Whether to ping. 'pinged' - Default is empty string. 'post_password' - Default is empty string. The password to access the attachment. 'guid' - Global Unique ID for referencing the attachment. 'post_content_filtered' - Post content filtered. 'post_excerpt' - Post excerpt.

Beispiele [ wp-snippets.com ]

Top Google Suchergebnisse

Mehr ...

0 Nutzerkommentare

Noch keine. Sei der Erste!

Neu hinzufügen ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics