Your problem is the constants OBJECT_K.
In the documentation you can read that this constant ensures that duplicate keys are discarded.
From the wordpress codex entry:
Any of ARRAY_A | ARRAY_N | OBJECT | OBJECT_K constants. With one of the first three, return an array of rows indexed from 0 by SQL result row number. Each row is an associative array (column => value, …), a numerically indexed array (0 => value, …), or an object. ( ->column = value ), respectively. With OBJECT_K, return an associative array of row objects keyed by the value of each row’s first column’s value. Duplicate keys are discarded.
Related Posts:
- $wpdb->get_results() does not fetch results with unicode ‘WHERE’ clause
- Help With MySQL to WPDB Query Conversion
- Creating mySQL procedure with $wpdb
- What are the common security flaws I need to look for? [closed]
- Making my plugin multi-site compatible
- dbDelta only creates the last table
- Creating 20,000 Posts or Pages using a .csv file?
- How does WordPress handle MySQL row lock errors?
- Is their any way to Extend WPDB class and Overwrite the Default Query Function
- Plugin Development sqlite or WordPress’ database
- Correct way to perform non-cacheable DB query
- Problem with creating tables for Plugin
- Prevent duplicate records in plugin table
- Change commission_status paid when withdraw_status vendor is completed
- How do I run SQL queries on a WordPress web page? [closed]
- 306 MB of wp_options occupied by WordPress SEO Plugin, is that normal? [closed]
- WordPress plugin creation how to execute .sql in order to insert multiple rows at activation of plugin
- Plugin: register_deactivation_hook works perfectly well, while register_activation_hook suddenly stopped working
- Insert data from .sql file in wordpress plugin
- WordPress Backend HA (Automatic failover)
- Migrating to WordPress Recipe Plugin and Some SQL Issues
- after wordpress update to 3.5+ i get many errors in plugin wpdb::prepare()
- Speeding SQL queries for a large database?
- Cannot get wpdb data (Error in a simple fuction) [closed]
- WPDB: Update table
- Issue running db create table query from static method
- $wpdb update query in plugin only updating one column
- DB Query not working in Plugin
- Way to send multiple values for column to MySQL?
- WordPress plugin: efficient way to store large data
- Displaying data from another database
- Plugin generating unexpected output – on WP mysql dump import
- WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version [closed]
- Can’t create tables with my plugin
- Integrating Custom Database with WordPress
- How to display results from a data table with an encrypted user id?
- JOIN and SUM different statement results (Mailster Database)
- How to get the custom field value using SQL query
- Memcaching recurring SQL Queries
- Need to know if my approach to designing a geneaology plug-in for wordpress makes sense
- I created a plugin with ‘view page’ that uses MYSQL + PHP. When I use wp_insert_post(), it turns everything to HTML
- How to get database connection details without longing to cpanel in WordPress?
- Performing CRUD operations on front end in wordpress
- Display a number value from mysql query in WP
- How to securely controlling data without keeping it in postmeta?
- WordPress UPDATE queries on MySQL database stuck
- Using id to show item
- Resetting AUTO_INCREMENT primary key
- Re-writing MySQl query for execute faster
- Create Database Tables on Plugin Activation hook
- Create Array from data in the OPTIONS table
- Write mysql credentials in plugin
- Linking Plugin Files to WP
- how to search through plugin in wordpress cimy-user-extra-fields?
- How to display blog posts only authored by the administrator
- How to dispaly post informations (such as titles) in an admin plugin menu page?
- How can I delete the options from DB when the plugin is deleted?
- How to check record is exist or not in WordPress CRUD Operation with $wpdb
- Remove posts that start with similar words (like a delete duplicate posts plugin)
- WP_Query does not return the result even if the data is present in the database
- Best way to initiate a class in a WP plugin?
- Why activate_plugin is not working in register_activation_hook
- Shortcode display outside the div
- Unable to load stylesheets and scripts to plugin settings page
- Licensing of freemium plugin
- Default Plugin Settings Not Writing to Database
- Create a custom page template inside my wordpress plugin
- How to add Internationalization in WordPress using Javascript/React?
- creating html reusable blocks via shortcodes
- I want to auto populate data in three fields if one drop down is selected
- Translation issue with global variables
- How to add category and subcategory in WordPress custom code?
- using wp_cache in plugin
- Check against server time to display SQL entries – Radio Station DJ Rotator Plugin
- Problem with MEMCACHE and Redis with wp_options
- I want to schedule email (date, time is in database->table) wp_schedule_event() not working
- WP options plugin setting not saving the selected checkboxes
- How to get post that has non zero or greater than zero meta value
- Plugin Works, but Widget Doesn’t
- Why haven’t I see plugins using get_file_data to handle retrieving plugin version?
- Create Custom Coupon Type
- How can I make my plugin detect if a certain theme is active?
- Plugin Block at the backend of every page or post
- Is it possible to create post in wordpress using postman?
- wp_enqueue_script doesn’t load JS in plugin
- AI Code For OpenAI
- Pulsing circle before the post title (Breaking news flash)
- How to provide page_template path in custom plugin using WordPress
- WordPress custom block: Link saved in database not retrieved when editing post
- Accessing Correct Database to Create REST API Endpoint
- Detect if user is on the specific page in WordPress
- A multi-section WordPress store [closed]
- Read page- or post-content across different builder-plugins
- How to make WordPress Plugin run on single specific Admin Page
- Frontend Enqueued Files in the Backend
- Why WP CLI command is not visible in VIP CLI
- How to add a react element into the DOM node (only on the user-interaction like on click) without using the state?
- WordPress theme development – the template dropdown in Pages and disappeared
- How to get next day date of a specific day
- How to verify/test that a custom built wordpress theme is as secure as possible?