- fixed singleton for shortcode;

- there were a conflicts with plugins who render shortcodes in hidden mode before loading shortcodes on the page content;
This commit is contained in:
Mykyta Synelnikov
2023-07-21 15:47:01 +03:00
parent 366563367d
commit ad11a6c479
+8 -6
View File
@@ -603,21 +603,23 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
*/
public function ultimatemember( $args = array() ) {
/**
* Filters variable for disable singleton shortcode loading on the same page.
* Note: Set it to `true` if you need to render the same form twice or more on the same page.
* Filters variable for enable singleton shortcode loading on the same page.
* Note: Set it to `false` if you don't need to render the same form twice or more on the same page.
*
* @since 2.6.8
* @since 2.6.9 $disable argument set to `true` by default
*
* @hook um_ultimatemember_shortcode_disable_singleton
*
* @param {bool} $disable Disabled singleton. By default, it's `false`.
* @param {bool} $disable Disabled singleton. By default, it's `true`.
* @param {array} $args Shortcode arguments.
*
* @return {bool} Disabled singleton or not.
*
* @example <caption>Turn on ability to use ultimatemember shortcode twice.</caption>
* add_filter( 'um_ultimatemember_shortcode_disable_singleton', '__return_true' );
* @example <caption>Turn off ability to use ultimatemember shortcode twice.</caption>
* add_filter( 'um_ultimatemember_shortcode_disable_singleton', '__return_false' );
*/
$disable_singleton_shortcode = apply_filters( 'um_ultimatemember_shortcode_disable_singleton', false, $args );
$disable_singleton_shortcode = apply_filters( 'um_ultimatemember_shortcode_disable_singleton', true, $args );
if ( false === $disable_singleton_shortcode ) {
if ( isset( $args['form_id'] ) ) {
$id = $args['form_id'];