Making WordPress.org

Changeset 13206


Ignore:
Timestamp:
02/12/2024 10:18:32 PM (16 months ago)
Author:
coffee2code
Message:

Photo Directory, Posts: Add optional $exclude arg to get_next_post_in_queue() to prevent specified posts from being selected.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/inc/posts.php

    r13172 r13206  
    350350     * @param string $order   The sort order used when determining the next post
    351351     *                        in queue. Either 'ASC' or 'DESC'. Default 'ASC'.
     352     * @param int[]  $exclude Array of post IDs to exclude from being selected
     353     *                        next. Default empty array.
    352354     * @return WP_Post|false The next post, or false if there are no other posts
    353355     *                       available for the user to moderate.
    354356     */
    355     public static function get_next_post_in_queue( $orderby = 'rand', $order = 'ASC' ) {
     357    public static function get_next_post_in_queue( $orderby = 'rand', $order = 'ASC', $exclude = [] ) {
    356358        $next = false;
    357359
     
    367369            'order'          => $order,
    368370            'orderby'        => $orderby,
     371            'post__not_in'   => $exclude,
    369372            'posts_per_page' => 1,
    370373            'post_status'    => 'pending',
Note: See TracChangeset for help on using the changeset viewer.