admin管理员组文章数量:1334158
I have this code, im Using ACF PRO to do a reverse relationship
<?php
/*
* Query posts for a relationship value.
* This method uses the meta_query LIKE to match the string "123" to the database value a:1:{i:0;s:3:"123";} (serialized array)
*/
$related_alerts = get_posts(array(
'post_type' => 'alerts',
// 'posts_per_page' => 1,
'meta_query' => array(
array(
'key' => 'route_affected_by_this_alert', // name of custom field
'value' => '"' . get_the_ID() . '"', // matches exactly "123", not just 123. This prevents a match for "1234"
'compare' => 'LIKE'
)
)
));
?>
I'm getting the post related to this post. Basically, I have some routes and here I'm getting the alerts related to these routes. The problem is that the client creates the alerts many times with different titles affecting the same alerts and I'm getting the same alert many times in a route with the same content. They are different post (alerts) but with the same content. The question is how can I just query the post without the same title or excerpt or content? What I want to know if you can help me to avoid querying content with the same content or excerpt, thank you very much.
本文标签: How to query post only with different excerpt
版权声明:本文标题:How to query post only with different excerpt? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742364310a2460975.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论