• 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

Laravel Nova, route not found

Not able to access model in the controller mautic

How to change HTML structure inside WP <head>

sort() not affecting original array while inside foreach loop

NGINX: connect() to unix:/var/run/php7.2-fpm.sock failed (2: No such file or directory)

auth pages not getting css in laravel

Get WooCommerce products from specific category

Additional price based on cart item count in WooCommerce

Coinpayments create_transaction "ERROR: Invalid command!"

Apply filter array/return terms

VB.NET WebRequest with PHP POST

Transpose and flatten two-dimensional indexed array where rows may not be of equal length

Where do I need to place a hook for phpunit?

Laravel query builder binding parameters more than once

Shopify password update using Shopify API

About Contact Privacy policy Terms and conditions