Custom page template how to check is_page from functions.php?

Using is_page() inside functions.php is fine, possible and working, and if you are echoing is_page(15) and getting true, that means you are on a page with the ID of 15.

the problem could be the priority parameter of the add_filter call, form the codex:

Make sure to set the priority
correctly, else the default WordPress
filter on this function will run last
and override what you set here.

so change your code to :

add_filter ( 'excerpt_length', 'custom_excerpt_length',999);

Leave a Comment