• 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

PHP | "The requested PHP extension bcmath is missing from your system."

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

Stop caching for PHP 5.5.3 in MAMP

How to get multiple values with same key from an array PHP

Multiple order by in WooCommerce

How to send upload image through email

How to pass data to all views in Laravel 5?

Implode array with array of glue strings

ldap is missing from system when installing adldap2 in laravel

MISSING UPDATES FOR: MEDIA Drupal 9

How to modify CSS in a specific page of the WP admin dashboard (backend)

PHP: PDO + CSV export not downloading (headers issue?)

WooCommerce Subscriptions: Remove role on cancelled subscription

Creating a config file in PHP

Laravel/ PHP: Order By Alphabetical with numbers in order [duplicate]

About Contact Privacy policy Terms and conditions