Forums

Create filter for complete site (2 posts)

  1. VeeBeeGlobal
    Member
    Posted 5 months ago #

    Hi all,
    Am hoping you can help me out.
    I have a custom site, which uses custom post types, and is also running multisite.
    I have wp_pagenavi installed also.

    The site runs well at the moment.

    I want to be able to use a filter across my whole site.
    So for example it filters all content to be from only one taxonomy, or one or a small number of category, or from only one post type.
    The filter should also apply to widgets.
    I have looked at pre_get_posts, but I get weird results.

    I have over 100,000 custom post records, and using query_posts is not the best as it essentially runs a double query...

    Any ideas??? I would be super grateful

    Vaughnn

  2. VeeBeeGlobal
    Member
    Posted 4 months ago #

    I managed to get this to work successfully.

    I used pre_get_posts and pre_join_posts.
    It only filters the results of the loop, so to filter other areas of the site, you need to construct sql 'where' and 'join' statements for those areas also (ie, widgets that may read categories that require filtering.)

    Cheers,

    V

Reply

You must log in to post.

About this Topic