Why Is My Shortcode Being Created on a New Line?

Shortcodes Render Improperly on the Front End

We are aware of a WordPress Editor ( not Popup Maker) issue that sometimes causes your Popup Maker shortcodes to line break and appear on individual lines for each shortcode. This obviously renders awkwardly on the front end.

For example, your WordPress Editor contains the following content:

X was the 2nd cousin 1x removed of Y by 2 routes: [popup_trigger id="3032"](1)[popup_trigger] and [popup_trigger id="3034"](2)[/popup_trigger]

This should display on the front end as:

X was the 2nd cousin 1x removed of Y by 2 routes: (1) and (2)

Because of the bug, it instead displays as:

X was the 2nd cousin 1x removed of Y by 2 routes:


Option #1

Disable the visual shortcode editor using the code below.

 *  Add the following code to your theme (or child-theme)
 *  'functions.php' file starting with 'add_action()'.
 * -------------------------------------------------------------------------- */
add_action( 'after_setup_theme', 'remove_pum_shortcode_ui' );
 *  Remove the shortcode user interface.
 *  @since 1.0.0
 *  @return void
function remove_pum_shortcode_ui() {
	if ( class_exists( 'PUM_Admin_Shortcode_UI' ) ) {
		remove_action( 'admin_init', array( PUM_Admin_Shortcode_UI::instance(), 'init_editor' ), 20 );

All this does is disable the Popup Maker Shortcode Button and the shortcode editor interfaces it comes with. This also means that our shortcodes will not render previews, which is where the problem is originating. Instead, the shortcode text will render, fixing the issue.

See the original PHP source on GitHub.

Option #2

Use the Text Tab of the  WP Editor to remove any line breaks between the text and the shortcode, so that they are all in one paragraph. This solution is fine - if you don't edit often. However, the first time you edit the post with the popup shortcodes again with the visual editor, it will break the lines again. Refreshing without saving will undo it.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.