Created
November 19, 2024 11:29
-
-
Save laxmariappan/5d336433b09c5d0b4010de466aa6355b to your computer and use it in GitHub Desktop.
Testing WP hooks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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