• 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

Encrypt in php and decrypt in Dart(flutter)

PHP Array split string and Integers

PHP to search within txt file and echo the whole line

Codeigniter, Severity: error --> Exception: Too few arguments to function, admin dashboard shows HTTP error 500

how to hide previous markers when new markers added in google map javascript api

php curl requesting twice

Json_Encode not returning html even i try to encode JSON_HEX_QUOT | JSON_HEX_TAG

Laravel MSSQL Server Connection not working

storagelogs/laravel.log" could not be opened in append mode: failed to open stream: Permission denied

How to upload mpdf file after generating to s3 bucket in php

PHP each() function replacement

Problems getting instance of UploadedFile in Yii2

RuntimeException: Unable to create the cache directory (/var/www/sonata/app/cache/dev)

How to put php code inside opening and closing shortcodes

Input and output values for php into the browser?

About Contact Privacy policy Terms and conditions