Description
Check if the code already exists as a shortcodeIf not then add to the options using bw_update_option() then empty out the code field for the next one
Usage
$bool = _diy_oik_add_shortcode( $diy_code );Parameters
- $diy_code
- ( string ) required – the shortcode the user is trying to add
Returns
bool true if OKSource
File name: diy-oik/admin/diy-oik.phpLines:
1 to 20 of 20
function _diy_oik_add_shortcode( $diy_code ) { $code = bw_array_get( $diy_code, "code", null ); do_action( "oik_add_shortcodes" ); global $shortcode_tags; bw_trace2( $shortcode_tags, "shortcodes" ); $code_exists = bw_array_get( $shortcode_tags, $code, false ); if ( $code_exists ) { p( "Shortcode $code already defined, try another code" ); $ok = false; } else { unset( $diy_code['code'] ); bw_update_option( $code, $diy_code, "diy_codes" ); // We don't need to add the shortcode now! $diy_code['code'] = ""; $ok = true; } return( $ok ); }
Called by
1 to 1 of 1
Invoked by
Calls
1 to 2 of 2
