• 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 install php_imagick on wamp64

Download & Save Zoom Recording in directory by PHP

How do I enable error reporting in Laravel?

Get number of working days between two dates in PHP [duplicate]

Upload a file Using PHP and JavaScript

oauth-private.key does not exist or is not readable

Laravel 5 session not persisting after user is logged in

Why is this PHP array not the same?

Post Form Data To phpmyadmin Database

Apply filter array/return terms

wordpress : How to specify the cause "This site can’t be reached"

Show rotation of tweets using current day of month

In PHP, which is faster: preg_split or explode?

How to create a scheduler application in php

Laravel - Implicit route model binding with soft deleted data

About Contact Privacy policy Terms and conditions