Shortcode not working inside html input

admin2025-06-02  1

I'm using Wordpress 4.2.3

The shortcode is added with the following:

function upsellxid_shortcode() {
    return '9eaa86d1a36a126313aa752c2ff8e16c';
}

function upsellxid_shortcode_2() {
    return '4849f6a5e3b188fa4b3b4c1f37975706';
}

function upsellxid_shortcode_rsa() {
    return '7a9bc3b332605817594dbac27847dff0';
}

function infusionsoftEmail_shortcode() {
    // Code
    $in = $_REQUEST;
    if (isset($_REQUEST['q'])) {
        $parse = parse_url($_REQUEST['q']);
        parse_str($parse['query'], $get);
        $in = $get;
    }

    $email = false;
    if (isset($in['inf_field_Email']) == true &&  empty($in['inf_field_Email']) == false) {
        $email = $in['inf_field_Email'];
    } else if(isset($in['Contact0Email']) == true &&  empty($in['Contact0Email']) == false) {
        $email = $in['Contact0Email'];
    }
    return $email;
}
add_shortcode('upsellxid', 'upsellxid_shortcode');
add_shortcode('xid_RSAMonthly', 'upsellxid_shortcode_2');
add_shortcode('rsa30daytrial', 'upsellxid_shortcode_rsa');
add_shortcode('infusionsoftEmail', 'infusionsoftEmail_shortcode');

Using it in a post seems fine (just [rsa30daytrial] will output the correct code). But using it inside an html input returns the raw text:

[rsa30daytrial]
[rsa30daytrial]
<input type="text" value="[rsa30daytrial]" />

results in (page source):

<p>7a9bc3b332605817594dbac27847dff0
7a9bc3b332605817594dbac27847dff0
<input type="text" value="[rsa30daytrial]" /></p>

I'm using Wordpress 4.2.3

The shortcode is added with the following:

function upsellxid_shortcode() {
    return '9eaa86d1a36a126313aa752c2ff8e16c';
}

function upsellxid_shortcode_2() {
    return '4849f6a5e3b188fa4b3b4c1f37975706';
}

function upsellxid_shortcode_rsa() {
    return '7a9bc3b332605817594dbac27847dff0';
}

function infusionsoftEmail_shortcode() {
    // Code
    $in = $_REQUEST;
    if (isset($_REQUEST['q'])) {
        $parse = parse_url($_REQUEST['q']);
        parse_str($parse['query'], $get);
        $in = $get;
    }

    $email = false;
    if (isset($in['inf_field_Email']) == true &&  empty($in['inf_field_Email']) == false) {
        $email = $in['inf_field_Email'];
    } else if(isset($in['Contact0Email']) == true &&  empty($in['Contact0Email']) == false) {
        $email = $in['Contact0Email'];
    }
    return $email;
}
add_shortcode('upsellxid', 'upsellxid_shortcode');
add_shortcode('xid_RSAMonthly', 'upsellxid_shortcode_2');
add_shortcode('rsa30daytrial', 'upsellxid_shortcode_rsa');
add_shortcode('infusionsoftEmail', 'infusionsoftEmail_shortcode');

Using it in a post seems fine (just [rsa30daytrial] will output the correct code). But using it inside an html input returns the raw text:

[rsa30daytrial]
[rsa30daytrial]
<input type="text" value="[rsa30daytrial]" />

results in (page source):

<p>7a9bc3b332605817594dbac27847dff0
7a9bc3b332605817594dbac27847dff0
<input type="text" value="[rsa30daytrial]" /></p>
Share Improve this question edited Jul 27, 2015 at 10:18 Mayeenul Islam 12.9k21 gold badges85 silver badges169 bronze badges asked Jul 27, 2015 at 10:07 paimoepaimoe 1711 silver badge5 bronze badges 1
  • 2 Follow this: wordpress.stackexchange/a/195673/22728 – Mayeenul Islam Commented Jul 27, 2015 at 10:19
Add a comment  | 

1 Answer 1

Reset to default 4

As above, https://wordpress.stackexchange/a/195673/22728 solved it:

add_filter( 'wp_kses_allowed_html', function ( $allowedposttags, $context ) {
    if ( $context == 'post' ) {
        $allowedposttags['input']['value'] = 1;
    }
    return $allowedposttags;
}, 10, 2 );
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1748794565a313775.html

最新回复(0)