'add_action' in assets.php


I’m adding some ajax functionality to my theme and have ran into some problems following tutorials. I’m trying to follow the sage workflow, and I can enqueue scripts in assests.php, but ‘add_action’ doesn’t seem to be working.

It seems sage is very much focused on using package managers for everything, but it is sometimes confusing to add some simple functionality to a theme.

BTW, I just started developing (not just wordpress) some months ago, so that might have something to do with my confusement. Let me know if I’m missing something.

Thanks for your time,


You probably don’t have the correct namespacing.
See here: https://roots.io/upping-php-requirements-in-your-wordpress-themes-and-plugins/

1 Like