Hot answers tagged

4

No, deactivated_plugin won't fire during a plugin's uninstallation process. But there are indeed two hooks that fire when a plugin is uninstalled: pre_uninstall_plugin, which is called right before a plugin is uninstalled. It acts globally, targeting any plugin. uninstall_{$file}, which fires after a specific plugin is uninstalled. Its scope it's limited ...


4

Your analogy here is partially correct, but incomplete: I understand that when do_action is called wp looks for all registered listeners and invokes them according set priority. You need to consider what happens when you call add_action. WordPress never searches for the add_action statements, it has those in a list. When you call add_action, it ...


3

wp_insert_post was introduced in changeset 2887, and was to fix bug #1681. I couldn't find the save_post hook's original provenance, but it was most recently added to core in changeset 3291, related to ticket #2063. Evidently it had existed in 1.5.2 (although version control does not support this theory) and needed to be added back for back-compat. So ...


2

The action name suggests it is run _after_the_content, not within the the_content itself, so you might have to do something different here like @SamuelElh is suggesting... You would add a function to the action with early priority to buffer, then add a filter to the final output with a late priority: add_action('tribe_events_single_event_after_the_content',...


1

If you want to use a variable from a another context in a function, create a class: class CustomLog { private $debug_msg = ""; public function __construct( $msg ) { $this->debug_msg = $msg; } public function log() { error_log( $this->debug_msg, 0 ); } } add_action( 'init', [ new CustomLog( "Hi there!" ), '...



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