add_filter the_content str_replace after shortcode

You can change the priority of actions and filters, it’s the third argument of add_filter (and add_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.

<?php 
add_filter('the_content', 'disable_autocomplete', 99);
function disable_autocomplete( $content )
{
    return str_replace('<form', '<form autocomplete="off"', $content);
}

Leave a Comment