$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>Shortcode not working inside html input|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

Shortcode not working inside html input

matteradmin6PV0评论

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 );

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far