WordPress.org

Ready to get started?Download WordPress

Forums

Add custom fields in the SELECT clause for wp_query (3 posts)

  1. michuk
    Member
    Posted 7 years ago #

    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!

  2. microkid
    Member
    Posted 6 years ago #

    It might be a little 'dirty', but you can use the 'posts_distinct' filter for this.

  3. themaiden
    Member
    Posted 6 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic