su_get_shortcode_defaults

The shortcodes-ultimate su get shortcode defaults function.

Published Date - February 15, 2021

Description

Get shortcode default settings.

su_get_shortcode_defaults( $id );

Parameters

  1. $id


Usage

The following example is for adding a hook callback.

if ( !function_exists( 'su_get_shortcode_defaults' ) ) {
    require_once ABSPATH . PLUGINDIR . 'shortcodes-ultimateshortcodes-ultimate/includes/functions-shortcodes.php';
}

// The input(s). 
$id = null;

// NOTICE! Understand what this does before running.
$result = su_get_shortcode_defaults( $id );
            

Defined

The function is defined in the following location(s).

shortcodes-ultimate/includes/functions-shortcodes.php

function su_get_shortcode_defaults( $id ) {

	$shortcode = su_get_shortcode( $id );
	$defaults  = array();

	if ( ! isset( $shortcode['atts'] ) ) {
		return $defaults;
	}

	foreach ( $shortcode['atts'] as $key => $props ) {
		$defaults[ $key ] = isset( $props['default'] ) ? $props['default'] : '';
	}

	return $defaults;

}