Sanitizing URL in a WordPress plugin

Good on you for trying to do this properly – but… how about this? global $wp; echo esc_url( home_url( $wp->request ) ); EDIT: Versions of your above code have been written all over the internet – see this SO question with 000s of votes. rather UN-intuitively it’s not a super simple thing to do as … Read more

settings api and the data passed in the parameter

You sanitization callback function get passed all the values that correspond with the setting name. When a POST request is made to the options.php file from the page on which your settings resides, WordPress calls your sanitization callback in a way that would resemble this: <?php boj_myplugin_validate_options( $_POST[‘boj_myplugin_options’] ); Notice that the name attribute looks … Read more

How to use checked() function with multiple check box group? How to properly sanitize that checkbox group?

So checked is fairly simple to understand. It compares the first two values. If they’re equal, it spits out checked=”checked” if they aren’t equal nothing happens. <?php $saved = ‘on’; $compare=”on” // spits out checked=”checked” checked($saved, $compare); $saved = ‘off’; // does nothing checked($saved, $compare); How you save check boxes it up to you. Because … Read more

How to handle complex data with Settings API

When you call register_setting, the third parameter is the sanitize callback function. You can do whatever data manipulation you need in that function, in order to arrange the user input into the format you need for your code. So after the data validation (integers are integers, sanitize text fields, etc.), you can retrieve the current … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)