search by meta field in the regular WordPress admin panel search

For regular admin panel search you should include “is_admin()” to be true. For checking for specific post type you should check from $query->get(“post_type”) Can you try to use this code add_action(“pre_get_posts”, function ($query) { if ($query->is_main_query() && is_admin() && in_array($query->get(‘post_type’), array(‘company’))) { $s = get_search_query(); $meta_query = [ ‘relation’ => ‘OR’, [ ‘meta_key’ => ‘_company_inn’, … Read more

wp-admin/admin-ajax.php 400 Bad request (chrome console)

To simplify your process and prevent redundant conditional checks just stack the two actions on top of each other. wp_ajax_ runs for authenticated users and thus does the conditional check of is_user_logged_in() anyway. wp_ajax_nopriv_ does the same thing, but looks for unauthenticated users. The actions themselves run the conditions anyway, so you needn’t run it … Read more

Secure way to add JS Script to WordPress filesystem

Thank you @Tom J Nowell letting me think about this. I had to think about it the last day, and this is the safe way to do this. function lwb_jquery() { $message=””; // Multisite Support if( is_multisite()) { $uri = get_stylesheet_directory() . ‘/sites/’ . get_current_blog_id(). ‘/assets/js/lwb-script.js’; $file_path=”[AKTIVES THEME]/sites/” . get_current_blog_id() . ‘/assets/js/lwb-script.js’; if( !file_exists( $uri … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)