posts; // } elseif ( current_user_can( 'edit_pages' ) ) { $query = 'SELECT ID AS value, post_title AS label, post_type AS type FROM ' . $wpdb->posts . ' WHERE post_author = ' . $user_ID; //} wp_enqueue_script( 'ayo', AdminYo_dirURL . '../js/ayo_search.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-autocomplete' ) ); $posts = $wpdb->get_results( $query, ARRAY_A ); $newpost = array(); foreach ($posts as $post) { $meta = ayo_isPinned($post["value"]); $post["pinned"] = $meta; $newpost[] = $post; } if( $newpost ) { wp_localize_script( 'ayo', 'ayo_data', $newpost ); } else { wp_localize_script( 'ayo', 'ayo_data', null ); } wp_localize_script( 'ayo', 'ayo_consts', array( 'admin_url' => admin_url(), 'home_url' => home_url( '/' ), 'plugins_url' => plugins_url('', __FILE__), 'str_nothing_found' => __( "Nothing found", 'ayo' ) ) ); } add_action( 'admin_enqueue_scripts', 'ayo_enqueue_scripts' ); //END of file