Uses
Uses | Description |
---|---|
wp-includes/user.php: get_current_user_id() | Get the current user’s ID |
wp-includes/post.php: get_posts() | Retrieves an array of the latest posts, or posts matching the given criteria. |
Get changeset posts.
(array) (Optional) Args to pass into get_posts()
to query changesets.
(int) Number of posts to return. Defaults to -1 (all posts).
(int) Post author. Defaults to current user.
(string) Status of changeset. Defaults to 'auto-draft'.
(bool) Whether to exclude changeset auto-drafts that have been dismissed. Defaults to true.
Default value: array()
(WP_Post[]) Auto-draft changesets.
File: wp-includes/class-wp-customize-manager.php
protected function get_changeset_posts( $args = array() ) { $default_args = array( 'exclude_restore_dismissed' => true, 'posts_per_page' => -1, 'post_type' => 'customize_changeset', 'post_status' => 'auto-draft', 'order' => 'DESC', 'orderby' => 'date', 'no_found_rows' => true, 'cache_results' => true, 'update_post_meta_cache' => false, 'update_post_term_cache' => false, 'lazy_load_term_meta' => false, ); if ( get_current_user_id() ) { $default_args['author'] = get_current_user_id(); } $args = array_merge( $default_args, $args ); if ( ! empty( $args['exclude_restore_dismissed'] ) ) { unset( $args['exclude_restore_dismissed'] ); $args['meta_query'] = array( array( 'key' => '_customize_restore_dismissed', 'compare' => 'NOT EXISTS', ), ); } return get_posts( $args ); }
Version | Description |
---|---|
4.9.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_customize_manager/get_changeset_posts