I want to add some new attributes into existing shortocode using some functions. What about below code,
function btn_shortcode( $atts, $content = null ) {
$a = shortcode_atts( array(
'class' => 'button',
'href' => '#'
), $atts );
return '<a class="' . esc_attr($a['class']) . '" href="' . esc_attr($a['href']) . '">' . $content . '</a>';
}
add_shortcode( 'button', 'btn_shortcode' );