• 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

Wordpress add responsive srcset header image to theme

Center point of multiple gps coordinates with php

Laravel Nova Dependency Container what are the allowed resource properties other than id in dependsOn

PHP mail sending empty mails

how do i retrieve and display the alt text of an image in wordpress?

PHP: PDO + CSV export not downloading (headers issue?)

Add Metadata, headers (Expires, CacheControl) to a file uploaded to Amazon S3 using the Laravel 5.0 Storage facade

Don't show recurring price for WooCommerce subscriptions worth 0$

Laravel Unknown Column 'updated_at'

How to get variable from JavaScript to PHP [duplicate]

Laravel Livewire: jQuery not working in child component loaded via @if statement

(Cache::lock()) -> get() -- Under what conditions does it return false?

"Unable to load dynamic library 'pdo_sqlsrv.so' "Cenos7 PHP7.2.10

Laravel Model save() & update() Not Saving

Webscraping Symfony/Panther: Can't get HTML

About Contact Privacy policy Terms and conditions