I have tried adding code to disable the wpautop function (below), but the problem still remains. Not sure if the plugin is using this function, if not it may be some other reason that is causing this to happen.
remove_filter( 'the_content', 'wpautop' );
remove_filter( 'the_excerpt', 'wpautop' );
The plugin does not add these tags, they are added by WP’s wpautop function.
When used in the main content area, the plugin already removes wpautop so that this does not occur.
Unless your lightbox uses WP’s content or excerpt functions, removing those filters (the_content / the_excerpt) wouldn’t turn off wpautop for your lightbox. My guess would be the ligthbox does not apply those filters.
I have been doing some testing on a blank page and found that whenever any code is added other than the forms shortcodes I get p tags wrapped around the HTML comments.
I tried adding just the forms and everything was fine, but when I added the social login plugin under the WP-Members login form the problem returned.
I then decided to search for where the plugin was dealing with wpautop and found the following code.
if ( strstr( $content, '[wpmem_txt]' ) ) {
// Fix the wptexturize.
remove_filter( 'the_content', 'wpautop' );
remove_filter( 'the_content', 'wptexturize' );
add_filter( 'the_content', 'wpmem_texturize', 999 );
}
This code is located in both class-wp-members.php and shortcodes.php which when removed seems to fix the issue.
The problem I have now is that there is [wpmem_txt][/wpmem_txt] wrapped around both forms as well as having to deal with updates to the plugin in future.
Any ideas on what I can do to solve this issue?
This code is located in both class-wp-members.php and shortcodes.php which when removed seems to fix the issue.
Interesting, since that is where the plugin is actually removing wpautop.
I might suspect that in the case of where you are implementing this it may be that process runs the wpautop filter after this point (it is assuming WP’s priority of 10 on the_content filter).
You can ask the shortcode to remove the [wpmem_txt] shortcode by adding the texturize parameter in the shortcode, such as:
[wpmem_form login texturize=”false”]
I have managed to get everything working properly by adjusting the code as shown below, but as soon as I add the wpmem_texturize call the problem returns.
if ( strstr( $content, '[wpmem_txt]' ) ) {
// Fix the wptexturize.
remove_filter( 'the_content', 'wpautop' );
$content = str_replace( array( '[wpmem_txt]', '[/wpmem_txt]' ), array( '', '' ), $content );
}
The problem seems to be linked to wpmem_texturize somehow as everything else works fine until i add this line back in.
add_filter( 'the_content', 'wpmem_texturize', 999 );