Hot answers tagged

2

The problem is the order of execution. The order things run matters. For your code to function, it would require either add_action to implement time travel several microseconds into the past so that it can add the hook before it ran, or it would require do_action to implement precognition so that it knows about add_action calls in the future that have not ...


1

You can't. Any secrets you put into your pages or JavaScript can be read out of the downloaded files by the client. Instead, you probably want to either move the secrets into your server side code and have your server code make requests to external APIs using the secrets, and use WordPress nonces and login cookies to authenticate your client scripts to your ...


1

I suspect that the html block element you're using doesn't handle php, which is why the script tag isn't working the way you hope. wp_localize_script() is a handy function to pass data from PHP to scripts. The function basically does the same thing you were trying to do with the html block. Lets say you're doing this in your theme and you have the following ...


1

You can use notify_moderator and notify_post_author filters to control whether or not the comment notification should be sent - to the moderator or comment author. add_filter('notify_moderator', 'prefix_filter_sent_comment_notification', 10, 2); add_filter('notify_post_author', 'prefix_filter_sent_comment_notification', 10, 2); function ...


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