How to use PHP Hear Documents | Wordpress

Asked 2 years ago, Updated 2 years ago, 122 views

I have customized searchform.php in wordpress.
Here's the code:

<?php
function my_search_form($form){
    $form='<form role="search" method="get" id="searchform" action="'.home_url('/').'>
    <div><label class="screen-reader-text" for="s">'.__('Search for:').'</label>
    <input type="text" value="'.get_search_query().'"name="s"id="s"/>
    <input type="submit" id="searchsubmit" value="'.esc_attr__('Search').'/>
    </div>
    </form>';
    return $form;
}
add_filter('get_search_form','my_search_form')

Now, I thought about using a hearing document that I didn't know where to use for a long ago.
I thought I could use it when I put a value (html code) in $form, but should I use the ear document here?

Please let me know if there is a lack of understanding of the hearing document.

php sql wordpress

2022-09-30 19:23

1 Answers

The Heard document itself does not mean anything more than simply 長いa useful syntax for defining long strings と.This is especially useful when you want to statically define a string that contains most new lines.Personally, I often use a pattern like writing SQL directly into the source, but I don't think it's necessary to use it in any particular case.

Is the source mentioned in the question Function Reference/get search form WWordPress Codex? As for the case here, I think it's okay whether you use a hearing document or not.

The security aspect is that if you use the screen without carefully verifying the user's input, it can be directly connected to the security hole.The above linked Notes also mention the XSS vulnerability.Heard documentation doesn't mean it's a security hole.


2022-09-30 19:23

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.