Code Monkey home page Code Monkey logo

Comments (5)

franz-josef-kaiser avatar franz-josef-kaiser commented on June 18, 2024

Currently doesn't work. Tested example is with 2 taxonomies and 2 terms. Query string is simply non sense. {$wpdb->prefix} is the site table prefix (considers multisites). The queried taxonomy terms have the IDs of 201 and 36. Shown query is for a logged in super admin user, hence the status of private, etc.

 AND ( 
     {$wpdb->prefix}_term_relationships.term_taxonomy_id IN (201) 
     AND tt1.term_taxonomy_id IN (36) 
)
AND {$wpdb->prefix}_posts.post_type = 'example_post_type' 
AND (
     {$wpdb->prefix}_posts.post_status = 'publish' 
     OR {$wpdb->prefix}_posts.post_status = 'future' 
     OR {$wpdb->prefix}_posts.post_status = 'draft' 
     OR {$wpdb->prefix}_posts.post_status = 'pending' 
     OR {$wpdb->prefix}_posts.post_status = 'private'
)
AND ID IN (
     SELECT object_id
     FROM {$wpdb->prefix}_term_relationships
     WHERE term_taxonomy_id
     IN ('201,36')
)

from filterama.

franz-josef-kaiser avatar franz-josef-kaiser commented on June 18, 2024

from filterama.

franz-josef-kaiser avatar franz-josef-kaiser commented on June 18, 2024
  • ✓ Add SQL WHERE clause extension

Done with an action/callback on pre_get_posts-filter. cfc5656#L2R35

Remember: You don't have to access the tax_query-object property of a WP_Query reference, but set the tax_query as query_vars part.

from filterama.

franz-josef-kaiser avatar franz-josef-kaiser commented on June 18, 2024

from filterama.

franz-josef-kaiser avatar franz-josef-kaiser commented on June 18, 2024
  • Removed need for sql clause
  • Easier internals

019e3d3#inc/match.class.php

from filterama.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.