I have the following code (below) in my theme. I am using redux framework for my theme options. My codes in a part looking like this. And I am really not sure about the security issue of this chunk of codes. Please any expert help me indicating any security problem in here. Your few minutes from your life would be really appreciated and helpful.

<?php if (isset($cosomic_options['blog_tag']) && $cosomic_options['blog_tag'] ) { ?>
 <div class="entry-meta-tag">
    <?php the_tags('', ' ', '<br />'); ?>
 <?php } ?>

<div class="entry-content">
     <?php $content = get_the_content();
        echo wp_trim_words( $content , '35' ); 

<?php $continue_reading = ''; ?>
<?php if (isset($cosomic_options['blog_continue_en']) && $cosomic_options['blog_continue_en'] ) { ?>
                        <?php if (isset($cosomic_options['blog_continue_en']) && $cosomic_options['blog_continue_en'] ) {

                        if ( isset($cosomic_options['blog_continue']) && $cosomic_options['blog_continue'] ) {
                            $continue_reading = $cosomic_options['blog_continue'];
                         }else {
                            $continue_reading = 'Continue Reading';
                         } ?>

                        <div class="a-btn">
                            <a href="<?php the_permalink(); ?>"><?php echo $continue_reading; ?> <i class="fa fa-hand-o-right"></i></a>
                        <?php } ?>
    <?php } ?> 

Security issues arise when you write code that open up possibilities for outsiders to access your database or otherwise compromise your installation.

The above code just reads options and content from the database and translates this into static html that will be send to the browser of the page's visitor. There's no code (like a form) that will allow the visitor to send information back to your server. So there are no security concerns.

(Of course there still could be vulnerabilities in other parts of your code.)

  • Thank you very much. actually I could not realize that it is just reading database. Actually I was worrying about the input was taken by redux framework and I am outputing those input by $cosomic_options['blog_continue'] . So, I thought may be we need some security. – Allen Titan Sep 1 '16 at 15:10
  • Well, I may hope the Redux Framewok sanitizes input it gets. If it doesn't you could be outputting unsafe html, but the problem is still not in your code. Input must be sanitized before it is written to the database, not when it is retrieved later. – cjbj Sep 1 '16 at 15:13

Redux framework has some issues but you can overcome it.

check this link

and check this link when you need to data valid and the code you submitted the codes is fine, you have not worry about it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.