I have this shortcode code:
add_shortcode( 'dashtest', function () {
$stringtest = "This is $wpc_cf_scorp";
echo $stringtest;
} );
It is attempting to pull in a custom field created by a plugin - I've been fiddling with this, but can't seem wrap my head around it - is there a special way to call in a custom field from a plugin to a shortcode? Thanks!
I have this shortcode code:
add_shortcode( 'dashtest', function () {
$stringtest = "This is $wpc_cf_scorp";
echo $stringtest;
} );
It is attempting to pull in a custom field created by a plugin - I've been fiddling with this, but can't seem wrap my head around it - is there a special way to call in a custom field from a plugin to a shortcode? Thanks!
Share Improve this question asked Oct 10, 2020 at 11:00 benjamin georgebenjamin george 112 bronze badges 5 |1 Answer
Reset to default 1add_shortcode( 'dashtest', function () {
$user_id = get_current_user_id();
$key = 'user_wpc';
$single = true;
$user_last = get_user_meta( $user_id, $key, $single );
if ($user_id == 0) {
echo 'You are currently not logged in.';
} else {
echo do_shortcode('[userwpcode key="'.$user_last.'/edit"]');
}
} );
$wpc_cf_scorp
seems undefined. – Ankit Commented Oct 10, 2020 at 14:53