• 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

Create tags in laravel post publishing

How to add automatically collapse/expand in content wordpress (single.php)?

Adding the custom page with add_menu_page function on Wordpress

Store / Website Column in Magento 2 Admin Grid - Custom Module

Select option from dropdown menu with PHP and mySql

The difference when using if statement true === something() vs something() === true [duplicate]

Read users and passwords from a txt file

OAuth2 Token PHP

How to edit Records using CodeIgniter

get data-value with variable value

How to submit the custom form data in database in WordPress without plugin using ajax?

Add record for each array elements if missing in table

Magento 2 - Controller returning blank page

Laravel 5: Is there a non-case sensitive way to sort a collection by an attribute?

generating a random code in php?

About Contact Privacy policy Terms and conditions