Changeset 51027 for trunk/src/wp-admin/includes/post.php
- Timestamp:
- 05/26/2021 02:16:01 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/post.php
r50809 r51027 764 764 * @since 2.0.0 765 765 * @since 5.2.0 Added the `$type` parameter. 766 * @since 5.8.0 Added the `$status` parameter. 766 767 * 767 768 * @global wpdb $wpdb WordPress database abstraction object. … … 771 772 * @param string $date Optional post date. 772 773 * @param string $type Optional post type. 774 * @param string $status Optional post status. 773 775 * @return int Post ID if post exists, 0 otherwise. 774 776 */ 775 function post_exists( $title, $content = '', $date = '', $type = '' ) {777 function post_exists( $title, $content = '', $date = '', $type = '', $status = '' ) { 776 778 global $wpdb; 777 779 … … 780 782 $post_date = wp_unslash( sanitize_post_field( 'post_date', $date, 0, 'db' ) ); 781 783 $post_type = wp_unslash( sanitize_post_field( 'post_type', $type, 0, 'db' ) ); 784 $post_status = wp_unslash( sanitize_post_field( 'post_status', $status, 0, 'db' ) ); 782 785 783 786 $query = "SELECT ID FROM $wpdb->posts WHERE 1=1"; … … 802 805 $query .= ' AND post_type = %s'; 803 806 $args[] = $post_type; 807 } 808 809 if ( ! empty( $status ) ) { 810 $query .= ' AND post_status = %s'; 811 $args[] = $post_status; 804 812 } 805 813
Note: See TracChangeset
for help on using the changeset viewer.