Add action wp_footer not working
add_action('wp_footer', 'ffu_feedbackform_hook');
function ffu_feedbackform_hook(){
echo apply_filters( 'the_content','[ffu_feedbackform]');
}; short-code doesn't work.
There are several reasons why your shortcode might not be working:
Incorrect shortcode syntax: Ensure that the shortcode syntax is correct. It should be in the format [shortcode_name] with no additional spaces or characters.
Missing shortcode function: Make sure that you have defined the shortcode function in your code. In your case, the shortcode function should be named
ffu_feedbackform
and it should return the HTML markup for your feedback form.Incorrect filter usage: The
apply_filters
function is used to apply WordPress filters to a given content. However, in your case, you don't need to use this function as you're simply outputting the shortcode directly. So, you can remove theapply_filters
function and directly echo the shortcode.
Here's the updated code with the above fixes:
add_action('wp_footer', 'ffu_feedbackform_hook');
function ffu_feedbackform_hook(){
echo do_shortcode('[ffu_feedbackform]');
}
Make sure to define the ffu_feedbackform
shortcode function to return the HTML markup for your feedback form.

No comments: