Как выбрать записи с определенными тегами/категориями в WordPress

Попробуйте это:

select p.*
from wp_posts p, 
wp_terms t, wp_term_taxonomy tt, wp_term_relationship tr
wp_terms t2, wp_term_taxonomy tt2, wp_term_relationship tr2

where p.id = tr.object_id
and t.term_id = tt.term_id
and tr.term_taxonomy_id = tt.term_taxonomy_id

and p.id = tr2.object_id
and t2.term_id = tt2.term_id
and tr2.term_taxonomy_id = tt2.term_taxonomy_id

and (tt.taxonomy = 'category' and tt.term_id = t.term_id and t.name = 'Category1')
and (tt2.taxonomy = 'post_tag' and tt2.term_id = t2.term_id and t2.name in ('Nuclear', 'Deals'))

По сути, я plugins использую 2 копии соответствующих mysql-query дочерних таблиц — terms, term_taxonomy php и term_relationship. Одна sql-select копия применяет ограничение mysql-query «Категория 1», другая — ограничение php-fpm «Ядерная энергетика» или mysql-query «Сделки».

Кстати, что это sql-query за проект с постами о ядерных mysql-query сделках? Вы пытаетесь внести mysql нас в какой-то правительственный sql-query список? ;)

php

mysql

sql

wordpress

plugins

2022-10-28T07:16:01+00:00