insert script (application(ld+json) from inside of action?
-
I have an
add_action
of a plugin currently running with the priority of 10.
Inside this action I want to add a<script type="application/ld+json">
tag to the head of the site but I don’t know how to do it.
I tried it with using anotheradd_action
, with different positions and priorities, anonymous functions but nothing worked so far except with a hacky way that looks like thiswp_register_script('custom-script', ''); wp_enqueue_script('custom-script'); wp_add_inline_script('custom-script', '</script><script type="application/ld+json">'.$code.'</script><script>');
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘insert script (application(ld+json) from inside of action?’ is closed to new replies.