• 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

Problems getting instance of UploadedFile in Yii2

Sum array values

laravel controller function parameters

Results page in other window

Docker image build with PHP zip extension shows "bundled libzip is deprecated" warning

Query Optimization, changing the queries in the loop into a single processing query

How to get rid of ampersand using WP Nonce URL and WP Redirect or PHP header

Match single unknown parameter php (Morse-code Regex)

loop through an anchor id

Access relation of pivot table in Laravel

Laravel Sanctum CSRF not authenticating

I need to link Google Sheet with my Laravel

how to get the header value, if we don't know the value because the value is random from the server

Printing more than one array using print_r or any other function in php

How to change product Image when variables are selected in Shop and Archive Pages?

About Contact Privacy policy Terms and conditions