• 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

Applying programmatically a coupon to an Order in WooCommerce3

Cannot connect to own websocket server when on secured domain

jwt decode throws Invalid argument supplied for foreach() on php-jwt and codeignitor 4

Update Order custom Field value with WooCommerce REST API

Override default Auth routes in Laravel 7

How to access a var with "-" in PHP [duplicate]

PHP Array split string and Integers

Make survey at laravel 5.4 and MySQL

How to install LDAP in Docker php-fpm alpine

What's the net::ERR_HTTP2_PROTOCOL_ERROR about?

How to MODIFY a Google Docs document via API using search-and-replace?

Laravel Multi-language routes without prefix

PHPExcel_IOFactory::createWriter causes wrong behaviour

SlimExceptionHttpNotFoundException

php code to send checkbox form results to email

About Contact Privacy policy Terms and conditions