• Hello,

    I want to modify a plugin to return posts of post_type=”page” based on an inequality on a meta value. I’m accomplishing this with posts right now using the following:

    add_filter (‘posts_where’, ‘my_where_function’);

    function my_where_function ($where)
    {
    global $wp_query, $wpdb;
    $user_value = get_current_user_value ();
    return $where . ” AND (meta_value IS NULL OR meta_value <= $user_value)”;
    }

    I’ve found that the function get_pages() in wp-includes/post.php is generating the where clause for listing the pages and I’m not sure what the best route is to create a plugin that will modify that where clause.

    Thanks in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘modify where clause on get_pages() query’ is closed to new replies.