The wpmem_txt shortcode is something that WP-Members puts in on the fly and its purpose is to prevent WordPress from putting line breaks (<p> and <br /> via the wpautop and wptexturize functions) into the form, thus throwing off the layout. This is one of those magic things that runs in the background that no one really knows about unless something breaks it.
Here is the problem: WordPress runs the shortcode parser on the content only once. By itself, that’s not a problem. However, if a plugin or theme developer includes a shortcode in their code and they do not use the function do_shortcode() on the $content variable before returning it, any shortcodes that are executed after theirs will be unparsed. For WP-Members, a bad practice like that will result in leaving wpmem_txt unparsed in your form.
So… how do you fix this?
The best option is to not use plugins or themes that don’t reparse the $content with do_shortcode. If the developer doesn’t know about this, then what other issues might be in their plugin or theme. Work with plugins and themes that comply with WordPress APIs?
In some cases, that may not be a workable solution because the offending plugin may be something that you really want to use. For those cases, we can apply a workaround.
When the login and registration form builder functions were rebuilt in 2.9, one addition was a set of defaults for the forms. These defaults include mostly wrappers and some other elements (like text for buttons and some other things). One of the wrappers is the wpmem_txt shortcode. This is the txt_before and txt_after arguments for both the login and registration form. The wpmem_login_form_args and wpmem_register_form_args filters can pass in an empty value for the wpmem_txt shortcode wrapper and that will remove the shortcode. Since the handle is the same for both the login and register forms, you can use one function for both filters.
The code snippet below can be added to your theme’s functions.php file to filter out the unparsed shortcode:
add_filter( 'wpmem_login_form_args', 'remove_wpmem_txt_code' ); add_filter( 'wpmem_register_form_args', 'remove_wpmem_txt_code' ); function remove_wpmem_txt_code( $args ){ $args = array( 'txt_before' => '', 'txt_after' => '' ); return $args; }
One important note here is that filtering out the wpmem_txt shortcode is a workaround for an outside unsolved problem. The better solution is to solve the problem. Because the shortcode is unparsed, that means you may run into problems with form layout – not always, but it is a possibility. The purpose of this shortcode is that it turns off wpautop and wptexturize for just WP-Members’ forms and replaces it with its own texturize filter. This prevents WP from assuming that you want html formatted paragraphs and line breaks in your form (which is being delivered as content).