Last active
July 10, 2022 10:08
-
-
Save frontend-coder/755ab92c5bf5021ba145eab07024585f to your computer and use it in GitHub Desktop.
32. Escape and attr #wordpress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<imput value='<?php echo esc_attr($name); ?>' | |
// обробити атрибут тега | |
'<?php echo esc_html($name); ?>' | |
// любий тег в текст переробляє | |
<a href="<?php echo esc_url(home_url('/')); ?>">link</a> | |
// esc_url() - link escape | |
$name = 'Імя - <a href="#">моє є Iceman, яке має <strong>стати </strong> особливим </a>'; | |
$arguments= array( | |
'a' => array( | |
'href'= array(), // працює атрибут | |
), | |
'strong' => array() // працює тег | |
); | |
echo wp_kses($name, $arguments); | |
echo wp_kses_post($name); // дозволяє всі дозволені базові теги в woprdress в пості | |
wp_kses_data($name); - дозволені теги в коментарях | |
esc_js() | |
esc_textarea() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment