• 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

How to disable widget block editor of WordPress?

how to insert data into select2 search input after scan using qrcode

Confirm Leave on External Links in Wordpress

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

correct PHP headers for pdf file download

Having trouble with PDO queries (Notice: Undefined index)

MySQL upgrade causing unexpected results on simple WHERE clauses

PHP each() function replacement

Set quantity minimum, maximum and step at product level in Woocommerce

How to identify whether webp image is static or animated?

Download & Save Zoom Recording in directory by PHP

Sentry on Symfony: how to exclude `NotFoundHttpException`

XDebug not working in VScode for php debugging

Woocommerce redirect after add-to-cart error

Dynamic table in HTML using MySQL and php

About Contact Privacy policy Terms and conditions