Auto delete empty posts

You want to write a wp_insert_post_empty_content filter. WordPress will already try and reject empty posts: $maybe_empty = ‘attachment’ !== $post_type && ! $post_content && ! $post_title && ! $post_excerpt && post_type_supports( $post_type, ‘editor’ ) && post_type_supports( $post_type, ‘title’ ) && post_type_supports( $post_type, ‘excerpt’ ); but I guess that logic isn’t catching your posts here. So … Read more

list of custom post by custom field in frontend

The main issue is that you’ve mixed up two methods of querying posts. You’re querying the correct posts here: $posts = get_posts(array( ‘numberposts’ => -1, ‘post_type’ => ‘assessment’, ‘meta_key’ => ‘customer’, ‘meta_value’ => $current_user_id )); But then the posts you’re actually looping through are queried here: $the_query = new WP_Query( $args ); Where $args is … Read more

inserting custom css, html and js into the current page as a popup window

I found a small solution BUT its not the best instead of what you ask! You can create an custom page template in your theme or child theme https://www.wpbeginner.com/wp-themes/how-to-create-a-custom-page-in-wordpress/#manual And paste the code: https://www.w3schools.com/howto/howto_js_alert.asp <!DOCTYPE html> <html> <head> <meta name=”viewport” content=”width=device-width, initial-scale=1″> <style> .alert { padding: 20px; background-color: #f44336; color: white; } .closebtn { margin-left: … Read more