Click here to Skip to main content
15,893,644 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to save the content in postmeta where shortcodes are extracted with do_shortcode.
My problem is that he use do_shortcode, but he doesn't take attributes of the shortcode.

the content like:
Hello world my name is [name first="foo" last="bar"].

With this code, I save the content in the postmeta:
PHP
function save($post_id){
if (isset($_REQUEST['content'])){
update_post_meta($post_id, 'custom', do_shortcode($_REQUEST['content']));
}
}


shortcode likes this:
PHP
function name($atts){
return "firstname".$atts['first'].", lastname".$atts['last'];
}


When I look in phpmyadmin to look the postmeta, i see this:
Hello world my name is firstname, lastname.

How can I fix this problem?
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900