Load More : Admin Ajax 400 Bad request, returning 0

You’re using an invalid Content-Type header. x-www-form-urlencoded isn’t a valid content-type. The correct content type is application/x-www-form-urlencoded. Essentially, the web server doesn’t know how to handle the content type you’re giving it to parse the parameters. This is why the request is failing with a 400 because WP is not getting anything in the POST … Read more

How to increase comment length?

Solved the issue. Thank you @birgire for giving me a hint. First I edited MySQL wp_comments table by changing comment_content rows «Type» from TEXT to MEDIUMTEXT and restarted MySQL. Then created filter in functions.php: add_filter( ‘wp_get_comment_fields_max_lengths’, ‘my_length’ ); function my_length ( $lengths ) { global $wpdb; $lengths = array( ‘comment_author’ => 245, ‘comment_author_email’ => 100, … Read more

How do I query Pending posts?

The WordPress REST API includes a ‘status’ parameter that can be used to retrieve posts based on their status. By default, the API only returns posts with a status of ‘publish’. If you want to query ‘pending’ posts, you’ll need to add ‘status=pending’ to your API call. However, please note that you will need appropriate … Read more

“Invalid parameter(s): attributes” issue in context of “blocks.registerBlockType” filter

In what way is the Tag Cloud block different? That block is a dynamic block, which uses a live rendering using ServerSideRender, and the documentation stated that “If you pass attributes to ServerSideRender, the block must also be registered and have its attributes defined in PHP“, therefore, custom attributes for the block must be defined … Read more

How to filter products by category in custom loop

Use $term->term_id instead of slug as the option value. Check if the $_GET[‘product-category’] exists, then append it to the $args array. $args = array( ‘post_type’ => ‘product’, ‘posts_per_page’ => 6, ‘paged’ => 1 ); if ( isset($_GET[‘product-category’]) && !empty($_GET[‘product-category’]) ) { $args[‘tax_query’] = array( array( ‘taxonomy’ => ‘product_cat’, ‘terms’ => $_GET[‘product-category’], ), ); } $loop … Read more

How could I create real-time filtering in this case?

As third-party plugin/library recommendations are not on-topic on this StackExchange, the next best option is a code-based solution. If you can describe why you can’t use a code-based solution I could possibly provide a better answer. You can accomplish this using some simple JavaScript event listeners on the <select> element. This would require you to … Read more

Is there a way to override only a portion of the function print_media_templates defined in wp-includes\media-template.php?

No, there isn’t. Unless there’s an apply_filters() call, you can’t modify any of the output. You mentioned “the only hook is to the entire function”, but that’s not the case either. There is a do_action() call at the end, but this is an action hook, so it only lets you run something at the end … Read more

tech