Can I pass a shortcode as an attribute of another shortcode? Wordpress

0

I'm doing a shortcode that allows me to show only x information to certain users, the shortcode receives an attribute (which would be the user's email), compares it and if it's the same it does x thing, but it's not going ...

    add_shortcode('verPago', 'sh_verPago' );

    function sh_verPago( $attr, $content = null ){

        extract( shortcode_atts( array( 'correo' => 'sinEmail' ), $attr ) );

        if ( $correo == "[email protected]" && !is_null( $content ) && !is_feed() )
        return $content;

    return "";
}

And that's how I put the shortcode in a text widget by the backend:

[verPago correo="[su_user field='user_email']"]
Si eres [email protected]
[/verPago]

Where [su_user field="user_email"] is another shortcode that offers me a plugin installed, if I directly post an email, if it works, but passing this shortcode does not go ...

    
asked by Luis 08.06.2017 в 19:44
source

1 answer

1

This is because the shortcodes do not process other shortcodes as a parameter automatically, but you can make your code do it if you use do_shortcode().

You must replace $correo == ... with do_shortcode($correo) == ...

Here is the detailed explanation (in English): link

    
answered by 09.06.2017 в 03:50