WordPress add_shortcode() Function Kodu
WordPress add_shortcode() Function Kodu
Eklenen kısa kod etiketinin benzersiz olduğundan ve daha önce eklenmiş diğer kısa kod etiketleriyle çakışmayacağından emin olmak için ön ek veya başka yöntemlerle özen gösterilmelidir. Kopyalanan bir etiket olması durumunda, en son yüklenen etiket öncelikli olacaktır.
function add_shortcode( $tag, $callback ) {
global $shortcode_tags;
if ( '' == trim( $tag ) ) {
$message = __( 'Invalid shortcode name: Empty name given.' );
_doing_it_wrong( __FUNCTION__, $message, '4.4.0' );
return;
}
if ( 0 !== preg_match( '@[<>&/\[\]\x00-\x20=]@', $tag ) ) {
/* translators: 1: shortcode name, 2: space separated list of reserved characters */
$message = sprintf( __( 'Invalid shortcode name: %1$s. Do not use spaces or reserved characters: %2$s' ), $tag, '& / < > [ ] =' );
_doing_it_wrong( __FUNCTION__, $message, '4.4.0' );
return;
}
$shortcode_tags[ $tag ] = $callback;
}