Contents

Intro

As of WordPress 4.2.3, the shortcodes API changed meaning that nested shortcodes (i.e. loop, tabs, accordion) could not contain shortcodes within html attributes. That means that code such as the following, no longer produced the expected result;

[loop query="posts_per_page=5"]
<a href="[the_permalink]" title="[the_title]">[the_title]</a>
[/loop]

The nested [the_permalink] and [the_title] shortcodes do not get parsed. They simply are left as an empty string.

WordPress made this change for security reasons and sadly, this was a breaking change.

[link_with_content]

[link_with_content] is equivalent to <a href="[the_permalink]" title="[the_title]">[the_title]</a>

Parameters

[link_with_content] can take the following parameters;

Examples

[loop query="posts_per_page=5"]
[link_with_content] 
[/loop]
[loop query="posts_per_page=5"]
[link_with_content link="google.com" content="Goes to google" link_class="class-1 class-2" link_before="Before the link" link_after="After the link" link_target="_blank"] 
[/loop]
[loop query="posts_per_page=5"]
[link_with_content link_is_id='yes' link_prefix='#'] 
[/loop]
[loop query="posts_per_page=5"]
[link_with_content link_is_cf='custom_field_name'] 
[/loop]

See Also

Other shortcodes were affected with the 4.2.3 upgrade. Please see the following;