WordPress Shortcode Adding New Shortcodes


Example

function footag_func( $atts ) {
    return "foo = {$atts['foo']}";
}
add_shortcode( 'footag', 'footag_func' );

In plugins we can add shortcodes using the add_shortcode function.

The shortcode can be used in any Wordpress page or post just by enclosing it in square brackets.

[footag]