• 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

onKeyUp event calculation not working on the following rows from php generated forms except the first one

enroll_table three field fetch to payment form to create payment field in laravel 5.5

Encrypt in php and decrypt in Dart(flutter)

Adding Multiple Custom Post Types in Wordpress

How to put php code inside opening and closing shortcodes

How can I access an array/object?

How can I get a div content in php

MySQL default time format UTC or GMT?

Laravel Multi-language routes without prefix

run a query using EXECUTE BLOCK to prepair a column for an unique-Index

How to put php code inside opening and closing shortcodes

Lumen - Postgresql setup - Composer

Facebook PHP SDK - will not logout properly

merge all files in directory to one text file

Pages are working fine on localhost but not running on the hosting server

About Contact Privacy policy Terms and conditions