2017-08-01 59 views
-1

我想通過meta_key和meta_value篩選我的結果。通過meta_value和meta_key進行篩選

我有一個視頻共享網站,我想過濾結果只是在羅馬尼亞視頻。

我嘗試使用此代碼:

query_posts(array('post_type' => array('episodes'), 'meta_key' => 'idioma', 'meta_value' => 'td','meta_compare' => 'IN')); 

不過,我想只顯示與meta_key idioma和meta_value與TD的結果。

這是我的數據庫:

https://prnt.sc/g2u38e

我嘗試用這個ARG:

$args = array(
    'post_type' => 'array ('episodes')', // Here is the type of posts, you told me I'm on array ('episodes') 
    'post_status' => 'publish', // If you have a post status, I assumed you would publish 
    'orderby' => 'td', // Ordered after meta_value and after meta_key 
    'meta_key' => 'idioma', // Custom meta_key name 
    'order'=> 'DESC' // sort descending 
); 

但它不工作。

+0

看看http://php.net/manual/en/function.array-filter.php – Pete

回答

1
change this 
'post_type' => 'array ('episodes')', 
to 
'post_type' => 'episodes', 
or 
'post_type' => 'array ("episodes")', 
+0

我會盡力,非常感謝你。我給你一個反饋。 – Kerossen2K

+0

歡迎Kerossen2K – Prince

+0

我在這裏添加更正的arg https://prnt.sc/g2v01v蝙蝠它不能工作,這是舊圖片,蝙蝠我糾正了post_type值。你能幫我嗎?並告訴我爲什麼不工作?非常感謝你的幫助。 – Kerossen2K

相關問題