View Categories

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: (1) and (2)

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:
(1)
and
(2)

Solutions #

Option #1 #

Disable the visual shortcode editor using the code below.

<?php
/**
 *  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.

Updated on October 24, 2024

Leave the first comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.