is_home does not work inside wp_enqueue_scripts

Asked

Viewed 20 times

0

I am creating a theme and want to specify which style sheets will be imported when loading the site, for this I am using the hook wp_enqueue_scripts. Within this action I do a check to see if it is on the home page, if it is a single or if it is an Archive, IE, I do a if(is_home()) with its variations. However the is_home function is returning false, although it is on the home page. I’ve used wp_reset_query(), but it didn’t solve the problem.

1 answer

0

Probably not working because you have set a main page in the wordpress settings, instead of the is_home(), place: is_front_page()

Browser other questions tagged

You are not signed in. Login or sign up in order to post.