How to check if the postID is in an array?

by Keyur Amin   Last Updated June 13, 2019 08:08 AM

In Wordpress, I am trying to check through an if else statement if the post is of a certain ID as follows:

<?php if ($post->ID == array(224,222,583,645,203,11,639,228,226,230,634,615,625,214,220,194)) : ?>
    ...do something...
<?php else : ?>
    ...do nothing...
<?php endif; ?>

This isn't working. Can you please help in knowing how to use the check the post ID in arrays?

Tags : array


Related Questions


Updated May 05, 2015 21:03 PM

Updated June 05, 2015 00:03 AM

Updated June 05, 2015 07:03 AM

Updated February 10, 2018 22:08 PM

Updated April 15, 2018 21:08 PM