Hot answers tagged

1 vote

Filter nav menu items HTML tags and wrap inner text with span

Just use link_before in your wp_nav_menu $args and add opening/closing span tags: $args = [ 'link_before' => '<span>', /* Add closing </span> to link_after */ 'link_after' =&...
user avatar
  • 35.6k
1 vote

How to add nonce tag to inline script for CSP

You can use the script_loader_tag filter: function wpse_406351_script_tag_nonce( $tag, $handle ) { if ( $handle === 'id_of_script' /* handle used in wp_enqueue_script/wp_register_script */ ) { ...
user avatar
  • 35.6k

Only top scored, non community-wiki answers of a minimum length are eligible