Are there any standard HTML markup for metabox?

WordPress.org UI Style Guide site has some reference materials, including those on Box Formats and Forms. As far as I remember it’s not consistently maintained or considered especially canonical source. In practice elements are often done after studying current state of actual admin markup.

Setting specific image size for specific form upload file field

Here’s an example of how to unset the standard WordPress sizes or any size for that matter assuming you know the image size name and of course you can simply inpect the $sizes array to determine what to unset… function wpse219360_disable_intermediate_image_sizes($sizes) { if ( isset($_FILES[‘file_input_1’]) && $_FILES[‘file_input_1’][‘error’] != UPLOAD_ERR_NO_FILE ) { unset($sizes[‘thumbnail’]); unset($sizes[‘medium’]); unset($sizes[‘large’]); } … Read more

How to retain the values from dropdown category lists after wrong form submission?

Like Ash was saying, something like this using $_REQUEST or $_POST will do it. <?php $args[‘exclude’] = “12,20”; // omit these two categories $categories = get_categories($args); ?> <select class=”selectpicker btn-block” name=”coupon_cat” id=”category”> <option value=””>Категори Сонгох</option> <!– if nothing else is selected, this will be selected automatically –> <?php foreach($categories as $category): ?> <?php $selected = … Read more

Help with verifying google recaptcha in a custom form

You need to validate the reCAPTCHA immediately once you POST the form. You’re just sending a POST to the same page, so it should be done before any other handling. If it does not validate, you need to show the form again, with an error message. function recaptcha_validated(){ if( empty( $_POST[‘g-recaptcha-response’] ) ) return FALSE; … Read more

How to return variables from admin-post.php

You can send GET variables in the URL using wp_redirect. For example: wp_redirect( home_url() .’/form?result=error&reason=3′); As far as I know, yes, admin-post is the best-practices way to handle POST data in WordPress.

Passing POST data from one WP post to another

You need to register the query var so it doesn’t get stripped by WP. Add this to your functions.php file. function foo_add_query_var($vars) { $vars[] = ‘discount’; return $vars; } add_filter(‘query_vars’, ‘foo_add_query_var’); To call this in your template, simply use the following: $discount = get_query_var(‘discount’);

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