WP Rest API – Change response status code for failed validation request
WP Rest API – Change response status code for failed validation request
WP Rest API – Change response status code for failed validation request
There’s a PHP function, called getimagesize(), it can do what you’re looking for. For example: $url is the image url $imgsize = @getimagesize( $url ); // @ is needed to prevent error messages if ( $imgsize // is the variable is not false && $imgsize[0] > 0 // and if the img width is larger … Read more
I’ve finally found the answer. Yes WP was ‘triggered’ to think it was evaluating a WordPress and not a WordPress-MU table structure. This was caused by the following lines: define(‘WP_ALLOW_MULTISITE’, true); define( ‘MULTISITE’, true ); in the wp-config.php that should NOT be there in a WordPress-MU 2.9.2 installation (but that some former developer had tossed … Read more
Could you please show us your code or better yet provide an example? Sight unseen, my preliminary thought based on your description is that you are using some of the new HTML5 form elements and/or attributes. In particular, the required attribute would cause the error that you are seeing depending on the browser that you … Read more
Use a HTML5 document declaration: <!Doctype html> XML self closing slashes are allowed in HTML5. In an attempt to turn this into a WordPress question (really, it isn’t): WordPress spits out hard coded XHTML style in many places. Since most people will not send real XHTML, HTML5 is the best option to deal with WordPress’ … Read more
First add a validation callback to your register_settings: register_setting( ‘settingsapi_optiongroupname’, ‘settingsapi_optionname’,’validation_callback’); then define validation_callback: function validation_callback($input){ //check if all is good //If so then return the wanted value to be saved //If Not then hook your admin notice function and return null to be saved ex: if ($something){ return $input; }else{ add_settings_error(‘unique_identifyer’,esc_attr(‘settings_updated’),__(‘Settings saved.’),’updated’); add_action(‘admin_notices’, ‘print_errors’); … Read more
Using isset isn’t the best option, because when you submit the form the post variables will still be set, just to null. You should check if the values are null. Also you are echoing the validation error messages, when you should be assigning them to a variable and returning the variable, then outputting the returned … Read more
Nonce generated is product of: user ID time $action argument The action is important part and needs to precisely describe what kind of event you are verifying. So if your actions are create something and delete something, your nonces should be generated for example like my_prefix_create and my_prefix_delete and verified accordingly.
You can temporarily remove the filter that adds paragraph tags: // remove the filter remove_filter( ‘the_content’, ‘wpautop’ ); // output content the_content(); // add the filter again add_filter( ‘the_content’, ‘wpautop’ );
If you are looking for a shortcode like this: [question text=”What has four legs?” answer=”Horse” message=”Right answer!” messageid=”message1″ ] with output like this: then here is a very simple non-jQuery skeleton version: add_shortcode(‘question’,’question_func_wpse_88192′); function question_func_wpse_88192($atts, $content = null ){ extract( shortcode_atts( array( ‘text’ => ”, ‘answer’ => ”, ‘message’ => ‘Right answer!’, ‘messageid’ => ‘message’, … Read more