• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

WordPress Security Standards want me to escape my html, but how to do it correctly?

phpwordpresselementorcodesniffer


PHP Snippet 1:

$output = "<HTML>
    <form>
        <div>
            <label>$i_am</label>
            <input type='text' name='i_am' value='' />
        </div>
        <div>
            <label>$and_i_am_looking_for</label>
            <input type='text' name='and_i_am_looking_for' value='' />
        </div>
    </form>
</HTML>";

PHP Snippet 2:

echo wp_kses(
    $output,
    array(
        'form'  => array(),
        'div'   => array(),
        'label' => array(),
        'input' => array(
            'type',
            'name',
            'value',
        ),
    )
);

Related Snippets

How can i hide dt if dd got empty value

mysql_result is defined but mysql_free_result warns it expected a resource

Send Outlook 2010 email using PHP

Redis Command To Sort Keys

carbon generated datetime not stored correctly into the database

Stop caching for PHP 5.5.3 in MAMP

"properties should not be accessed directly" issue during WooCommerce 3.0 checkout

SilverStripe unable to populate multiple member Childs

How to get rid of ampersand using WP Nonce URL and WP Redirect or PHP header

GuzzleHttp Hangs When Using Localhost

How to auto populate preferredCountries from intl-tel-input with db output

Laravel whole batch is cancelled if one Job fails

Reading input in php from terminal

PHP file_get_contents function

Add custom text under order details on WooCommerce My account view order pages

About Contact Privacy policy Terms and conditions