I try to add a hook inside WordPress functions.com file.
An example: wp_enqueue_script( 'google_api', 'https://maps.googleapis.com/maps/api/js?v=3 bla bla','',''); How to manage also async defer to the script element?
<script src="" async defer></script>
Need help.
not2easy
1:11 pm on Sep 23, 2023 (gmt 0)
Not all WP themes use a given or generic functions.php file, it usually works in concert with other pieces of the theme. The best place for customizing your functions file is by talking with the theme's creators. A person would need to know the 'other' files in use that are also tied to in order to integrate with those files.
For example, a line from a functions file I use has this (using example for the theme name):
// Enqueue Scripts. add_action( 'wp_enqueue_scripts', 'example_load_scripts' ); function example_load_scripts() {
so it would be difficult to have it work as expected using a general script.
You may be able to adapt other lines found in your functions.php file to help achieve your goal, but a 'general' script may not perform as expected.