Skip to content

Instantly share code, notes, and snippets.

@laxmariappan
Created November 19, 2024 11:29
Show Gist options
  • Select an option

  • Save laxmariappan/5d336433b09c5d0b4010de466aa6355b to your computer and use it in GitHub Desktop.

Select an option

Save laxmariappan/5d336433b09c5d0b4010de466aa6355b to your computer and use it in GitHub Desktop.
Testing WP hooks
<?php
/**
* Plugin Name: Testing
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
// Hook into wp_footer to trigger the custom action
add_action('wp_footer', 'testing_callback');
function testing_callback() {
do_action('footer_message');
}
// Filter the content with the custom filter
add_filter('the_content', 'testing_filter_callback');
function testing_filter_callback($content) {
$content = apply_filters('wp_hooks_guide_filter', $content);
return $content;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment