最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

customization - save short-code in my custom plugin settings problem missed something

programmeradmin0浏览0评论

i want to have dynamic shortcode to CF7

when i create new Contact form the id is different from develop env to production

i decide to put my shortcodes in my plugin settings.

and use them as option

            <?php
            echo do_shortcode(get_option("email_ShortCode_text"));
            ?>

the more important code is this code that used in setting:

        <p>Enter your email_shortcode
        </p> <input type="text" name="email_ShortCode_text" value="<?php echo get_option('email_ShortCode_text'); ?>" />

        <hr />

but when user put his shortcode in my plugin setting then save it worked

but second time when shortcodes raed from database missed some characters

so when save all those settings missed

please help me

how can i convert setting to normal string when read from wordpress?

thank you

i want to have dynamic shortcode to CF7

when i create new Contact form the id is different from develop env to production

i decide to put my shortcodes in my plugin settings.

and use them as option

            <?php
            echo do_shortcode(get_option("email_ShortCode_text"));
            ?>

the more important code is this code that used in setting:

        <p>Enter your email_shortcode
        </p> <input type="text" name="email_ShortCode_text" value="<?php echo get_option('email_ShortCode_text'); ?>" />

        <hr />

but when user put his shortcode in my plugin setting then save it worked

but second time when shortcodes raed from database missed some characters

so when save all those settings missed

please help me

how can i convert setting to normal string when read from wordpress?

thank you

Share Improve this question edited Oct 14, 2019 at 9:24 saber tabatabaee yazdi asked Oct 14, 2019 at 8:36 saber tabatabaee yazdisaber tabatabaee yazdi 1931 gold badge5 silver badges13 bronze badges 2
  • 1 The more important code here is the code for adding and saving the setting. – Jacob Peattie Commented Oct 14, 2019 at 8:47
  • thank you ... i put it here for you. – saber tabatabaee yazdi Commented Oct 14, 2019 at 9:22
Add a comment  | 

1 Answer 1

Reset to default 0

just need to use text area instead of input in your settings page:

        <p>Enter your email shortcode
        </p> <textarea type="text" name="email_ShortCode_text" > <?php echo stripslashes(get_option('email_ShortCode_text')); ?>" </textarea>

        <hr />
发布评论

评论列表(0)

  1. 暂无评论