• 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

Implode columnar values between two arrays into a flat array of concatenated strings

Split comma separated value from table column into rows using mysql?

Getting values for an enum?

Spam Filter in Contact Form

wordpress function breaks wp-admin

Make certain characters of a word from string bold

Using if(isset($_POST['submit'])) to not display echo when script is open is not working

How to put php code inside opening and closing shortcodes

Not able to override collapsible.js in magento 2

dompdf and img tag, image wont show

Laravel MSSQL Server Connection not working

hidden INPUT value not available in $_POST

Laravel - How to properly generate unique slugs from article titles?

How to convert binary string to normal string in php

Confirm Leave on External Links in Wordpress

About Contact Privacy policy Terms and conditions