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