i have been trying to display all posts of similar category on one page (best ones)

enter image description here

work fine with is_home() but isn't working with is_page() or is_category().

1 Answer 1


If it works with is_home() then I think it is just a problem with your slug.

Have you tried to check the is_page by it ID directly?

Something like this should return /* * Returns true when the Pages displayed is either post ID 1, * or post_name "top-best", or post_title "Top Best". * Note: the array ability was added in version 2.5. */ is_page( array( 1, 'top-best', 'Top Best' ) );

Source : https://developer.wordpress.org/reference/functions/is_page/#comment-370


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.