Custom Gutenberg Block ‘Stylized List’ – Incorrect Rendering and Looping of List Items

Use unique indices for List item keys. I.e., use package like https://www.npmjs.com/package/uuid to generate unique indices or useInstanceId to generate them. Note that if you use useInstanceId generated Id’s will be unique, but you will get odd or even numbers because of the way React renders components (which does not matter, unless you want to … Read more

SQL phpmyadmin remove posts from cat id exclude condition

finally I find right code with helping by ChatGPT DELETE p FROM wp_posts p INNER JOIN wp_term_relationships tr1 ON (p.ID = tr1.object_id AND tr1.term_taxonomy_id = 2) LEFT JOIN wp_term_relationships tr2 ON (p.ID = tr2.object_id AND tr2.term_taxonomy_id = 20) WHERE p.post_type=”post” AND p.post_status=”publish” AND DATEDIFF(NOW(), p.post_date) > 180 AND tr2.term_taxonomy_id IS NULL; Lets try another way … Read more

How to make all post under post_type to draft or return a 404?

Not tested, but if I have inderstood the question correctly, please try the below solution. Articles post type will return a 404 but posts under movies categories will not. Code goes in a functions.php of your child theme. function rr_404_custom_post_types() { global $wp_query; if (is_single() && !($wp_query->post->post_type == ‘movies’)) { $wp_query->set_404(); status_header(404); } } add_action(‘template_redirect’, … Read more

Restricting Image Upload Sizes using ‘wp_handle_upload_prefilter’ – Stuck media progress bar when Featured Image?

Try using JavaScript to handle this situation. The script should run when a user attempts to upload an image, and if the image upload fails, it will remove the associated UI elements (including that stubborn loading bar). Here’s a quick code: jQuery(document).ready(function($) { wp.Uploader.prototype.init = function() { this.uploader.bind(‘BeforeUpload’, function(uploader, file) { uploader.settings.multipart_params = { …uploader.settings.multipart_params, … Read more

How to pass variable from wp_loaded hook to custom function?

passing hook $_GET value from hook to function. The reason I’m using wp_loaded hook is because he is the only one that able to receive $_GET values. This is not a thing. Hooks don’t receive $_GET values, that’s not something that happens or needs to be done. You can use $_GET anywhere. You can safely … Read more

How to show a message after submitting a form (form made using plugin)

Using the function wp_redirect() may fail due to the timing of its usage and the already sent headers on your form page. I recommend using jQuery and AJAX for handling form submissions. This first approach allows the response to be displayed on the same page as the form, avoiding conflicts with the original page headers. … 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

SMTP email does not work even with the right firewall rules

Make the following test. Disable all of your SMTP plugins. Temporarily enable WP_DEBUG and WP_DEBUG_LOG in your “wp-config.php” file. Insert the following code in your theme “functions.php” file: add_action( ‘phpmailer_init’, function ( $phpmailer ) { $phpmailer->isSMTP(); $phpmailer->Port = 587; $phpmailer->SMTPAuth = true; $phpmailer->SMTPSecure=”tls”; $phpmailer->FromName = get_bloginfo( ‘name’ ); // Type your SMTP credentials below. $phpmailer->From … Read more

need help. plz help me. i cannot install wordpress

To help you troubleshoot, consider the following things to do: Check Apache and PHP Installation: Make sure Apache and PHP are installed correctly on your system. If you’re new to WordPress development, using tools like LocalWP or WAMP can simplify the setup process. Verify URL Structure: Ensure that your URL points to the correct folder … Read more