Which to use to execute code during the saving of a plugin settings page?

If you’re using Settings API, then you should use a sanitize callback: register_setting( $option_group, $option_name, $sanitize_callback ); The myth is that the $sanitize_callback actually is a filter for your options when it’s saved in the database. This is the place where you can do something with your custom code. This is the sample code: register_setting( … Read more

Output in XHTML or HTML 5 for plugins?

WordPress will not help you here. In back-end use conservative XHTML 5: <br />, but not <figure> (see WP coding standards). In front-end … it is hard to determine the Doctype and the usage of polyfills, so stay with regular HTML as long as possible or load the necessary polyfills from your plugin.

wordpress get meta value by meta key

WP_Query selects posts and not meta value that is way you are not getting the value. You can use the returned post ID to get the value something like: $args = array( ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => 1, ‘meta_key’ => ‘picture_upload_1’ ); $dbResult = new WP_Query($args); global $post; if ($dbResult->have_posts()){ $dbResult->the_post(); $value … Read more

How to use update and delete query in wordpress

About UPDATE+INSERT: I have made a function for myself, and might help you too, i.e. : UPDATE_OR_INSERT(‘wp_users’, array(‘gender’=>’female’), array(‘name’=>’Monika’) ); that will UPDATE A VALUE in column (where name=monika), but in case that value doesnt exists, then it creates a new record in DB. Why this is necessary? because As far as i know, there … Read more

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