I want to add a PHP str_replace
to the add_filter('the_content')
function. I believe my problem is that the shortcodes are loading after the str_replace
is called.
I have a shortcode that outputs a form, i want to make it that in all HTML form tags, the attribute autocomplete='off'
.
Heres the code i have.
add_filter('the_content', 'disable_autocomplete');
function disable_autocomplete( $content )
{
return str_replace('<form', '<form autocomplete="off"', $content);
}
Any ideas?
You can change the priority of actions and filters, it’s the third argument of
add_filter
(andadd_action
) and it defaults to 10. So change it to a high number and have your filter fire way after the shortcodes and other stuff are inserted.