Show the submitted values in the form when validation fails

You can’t. If you’re using the settings API correctly, here’s what happens when you try to save your options: Form posts to options.php WordPress handles $_POST and runs update_option on your registered settings Your sanitize callback from register_setting is applied Any data that fails/you don’t return in your callback isn’t saved WordPress redirects back to … Read more

Can’t trigger an AJAX function with a submit button in the dashboard

Just remove type=”submit” from your button and let your jQuery ajax call be triggered first. Once you get the response then you can submit your form as well. Something like this; function your_action_javascript() { ?> <script type=”text/javascript” > jQuery(document).ready(function($) { $(‘.button’).on(‘click’, function () { var data = { ‘action’: ‘your_action’ }; // since 2.8 ajaxurl … Read more

Spammers attacking my WordPress Site – Removing URL field from core? [closed]

The decision about comment status upon posting is made by wp_allow_comment() function. There is a filter in it that can be used to change it accordingly. Basic form would look something like this (not tested): add_filter( ‘pre_comment_approved’, function( $approved, $commentdata ) { if ( ! empty( $commentdata[‘comment_author_url’] ) ) { return ‘spam’; } return $approved; … Read more

meta_query issue with multiple numerics

Untested and semi-pseudo code obviously. The idea is that a meta query is already an array of arrays, each field in your form is another nested array. If a value exists we push it onto the array. <?php $_location = $_GET[‘location’] != ” ? $_GET[‘location’] : ”; $_status = $_GET[‘status’] != ” ? $_GET[‘status’] : … Read more

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