简体   繁体   中英

Test if post parent NOT equals multiple ID's

I want to test for multiple id's of post parents. currently i'm testing for post parent with the ID of 23 but I also want to test for parent ID of 1389. How do I do this?

<?php if($post->post_parent!==23){ ?>scale-with-grid<? } ?>

您可以为此使用in_array函数:

if(!in_array($post->post_parent, array(23, 1389)) ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM