• I’m using filters: posts_join and posts_where to narrow my query results for specific pages and it works fine.

    Now, I added a new table that joins with the wp_posts table (1 to 1 relationship) and I need to display some of the columns from this table on the screen.

    I cannot find “posts_select” filter. Is there any? I couldn’t find anything like that in the docs.

    Any help how to overcome this would be appreciated!

Viewing 2 replies - 1 through 2 (of 2 total)
  • It might be a little ‘dirty’, but you can use the ‘posts_distinct’ filter for this.

    This is a month old topic but the codex lists the following query hooks :

    posts_where
    posts_join
    posts_groupby
    posts_orderby
    posts_distinct
    posts_fields
    post_limits
    posts_where_paged
    posts_join_paged
    posts_request filters

    Looks like ‘posts_fields’ is the one you want.

    Take care.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add custom fields in the SELECT clause for wp_query’ is closed to new replies.