*
* @since 1.5.0
*
+ * @global wpdb $wpdb
+ *
* @param array $post_data Optional.
* @return int Post ID.
*/
wp_set_post_lock( $post_ID );
- if ( current_user_can( $ptype->cap->edit_others_posts ) ) {
+ if ( current_user_can( $ptype->cap->edit_others_posts ) && current_user_can( $ptype->cap->publish_posts ) ) {
if ( ! empty( $post_data['sticky'] ) )
stick_post( $post_ID );
else
*
* @since 2.7.0
*
+ * @global wpdb $wpdb
+ *
* @param array $post_data Optional, the array of post data to process if not provided will use $_POST superglobal.
* @return array
*/
$post->post_status = 'draft';
$post->to_ping = '';
$post->pinged = '';
- $post->comment_status = get_option( 'default_comment_status' );
- $post->ping_status = get_option( 'default_ping_status' );
+ $post->comment_status = get_default_comment_status( $post_type );
+ $post->ping_status = get_default_comment_status( $post_type, 'pingback' );
$post->post_pingback = get_option( 'default_pingback_flag' );
$post->post_category = get_option( 'default_category' );
$post->page_template = 'default';
*
* @since 2.0.0
*
+ * @global wpdb $wpdb
+ *
* @param string $title Post title
* @param string $content Optional post content
* @param string $date Optional post date
*
* @since 2.1.0
*
+ * @global WP_User $current_user
+ *
* @return int|WP_Error
*/
function wp_write_post() {
*
* @since 1.2.0
*
+ * @global wpdb $wpdb
+ *
* @return mixed
*/
function get_meta_keys() {
*
* @since 1.2.0
*
+ * @global wpdb $wpdb
+ *
* @param int $postid
* @return mixed
*/
*
* @since 2.5.0
*
+ * @global wpdb $wpdb
+ *
* @param string $type
* @return mixed
*/
}
if ( isset( $view_post ) ) {
- if( 'draft' == $post->post_status ) {
+ if ( 'draft' == $post->post_status ) {
$preview_link = set_url_scheme( get_permalink( $post->ID ) );
/** This filter is documented in wp-admin/includes/meta-boxes.php */
$preview_link = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ), $post );
*
* @since 2.9.0
*
+ * @global int $content_width
+ * @global array $_wp_additional_image_sizes
+ *
* @param int $thumbnail_id ID of the attachment used for thumbnail
* @param mixed $post The post ID or object associated with the thumbnail, defaults to global $post.
* @return string html
function _wp_post_thumbnail_html( $thumbnail_id = null, $post = null ) {
global $content_width, $_wp_additional_image_sizes;
- $post = get_post( $post );
+ $post = get_post( $post );
+ $post_type_object = get_post_type_object( $post->post_type );
+ $set_thumbnail_link = '<p class="hide-if-no-js"><a title="%s" href="%s" id="set-post-thumbnail" class="thickbox">%s</a></p>';
+ $upload_iframe_src = get_upload_iframe_src( 'image', $post->ID );
- $upload_iframe_src = esc_url( get_upload_iframe_src('image', $post->ID ) );
- $set_thumbnail_link = '<p class="hide-if-no-js"><a title="' . esc_attr__( 'Set featured image' ) . '" href="%s" id="set-post-thumbnail" class="thickbox">%s</a></p>';
- $content = sprintf( $set_thumbnail_link, $upload_iframe_src, esc_html__( 'Set featured image' ) );
+ $content = sprintf( $set_thumbnail_link,
+ esc_attr( $post_type_object->labels->set_featured_image ),
+ esc_url( $upload_iframe_src ),
+ esc_html( $post_type_object->labels->set_featured_image )
+ );
if ( $thumbnail_id && get_post( $thumbnail_id ) ) {
$old_content_width = $content_width;
$thumbnail_html = wp_get_attachment_image( $thumbnail_id, 'post-thumbnail' );
if ( !empty( $thumbnail_html ) ) {
$ajax_nonce = wp_create_nonce( 'set_post_thumbnail-' . $post->ID );
- $content = sprintf( $set_thumbnail_link, $upload_iframe_src, $thumbnail_html );
- $content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail" onclick="WPRemoveThumbnail(\'' . $ajax_nonce . '\');return false;">' . esc_html__( 'Remove featured image' ) . '</a></p>';
+ $content = sprintf( $set_thumbnail_link,
+ esc_attr( $post_type_object->labels->set_featured_image ),
+ esc_url( $upload_iframe_src ),
+ $thumbnail_html
+ );
+ $content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail" onclick="WPRemoveThumbnail(\'' . $ajax_nonce . '\');return false;">' . esc_html( $post_type_object->labels->remove_featured_image ) . '</a></p>';
}
$content_width = $old_content_width;
}