• 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

Sagepay Error The Vendor failed to provide a RedirectionURL

Display a product custom field only in WooCommerce Admin single orders

Magento 2 - Controller returning blank page

Wordpress add responsive srcset header image to theme

WordPress ACFNotice: get_field() - We've detected one or more calls to retrieve ACF field values before ACF has been initialized

WordPress + Nginx on non-standard port behind AWS ELB results in broken links

Applying programmatically a coupon to an Order in WooCommerce3

500 Internal Server Error on Ajax request. Not sure the origin of the problem

Last order would be re-order in wooCommerce. How is it possible?

Clear javascript source cache laravel 5.8

Yoast SEO (WordPress Plugin) - Get plugin generated data manually

How to Create WooCommerce Subscription Product via. REST API?

Transpose multidimensional array and join values with commas

Filter array by skipping every nth element from the end

Array to string conversion

About Contact Privacy policy Terms and conditions