I have a problem with the shortcode, it does not show me the values I enter correctly
For example, this shortcode:
function subscribe_link_att($atts) {
$default = array(
'link'=>'',
'title' => ''
);
$a = shortcode_atts($default, $atts);
return 'Follow us on <a href="'.$a['link'].'">'.$a['title'].'</a>';
return ob_get_clean();
}
add_shortcode('subscribe', 'subscribe_link_att');
It shows me this:
Follow us on <a href="">’sqsqsc</a>
Current Wordpress version: 6.7.1
I have a problem with the shortcode, it does not show me the values I enter correctly
For example, this shortcode:
function subscribe_link_att($atts) {
$default = array(
'link'=>'',
'title' => ''
);
$a = shortcode_atts($default, $atts);
return 'Follow us on <a href="'.$a['link'].'">'.$a['title'].'</a>';
return ob_get_clean();
}
add_shortcode('subscribe', 'subscribe_link_att');
It shows me this:
Follow us on <a href="">’sqsqsc</a>
Current Wordpress version: 6.7.1
Share Improve this question edited Feb 26 at 12:38 LoicTheAztec 255k24 gold badges397 silver badges443 bronze badges asked Dec 20, 2024 at 19:08 jimi-deljimi-del 1331 gold badge3 silver badges12 bronze badges 01 Answer
Reset to default 0Your provided code does not show where this shortcode is used. By default, the values for "link" and "title" are null so unless you provide it with a new value the shortcode will return null.
try using [subscribe link="https://stackoverflow/" title="Stack Overflow"]