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
- Updating wp_postmeta from meta_keys and meta_values from another table having price and sku only
- How to properly prepare a column name if passed to a stored procedure?
- Best way to retrieve data in custom api extended from wp-api
- WordPress Widget Not Saving Instance
- Issue with wp_handle_upload
- How to rewrite URL and get the values?
- what is the point of telling add_filter how many parameters you want passed to the function?
- $wpdb->prepare is not working like mysql_real_escape_string
- How to Show Author image and url in WordPress plugin directory? [closed]
- How to add filter for wordpress plugin?
- WordPress API functions not working at AJAX functions.php call
- What’s the right way to implement functions in footer.php
- How to add category and subcategory in WordPress custom code?
- Do rewrites added with add_rewrite_rule() persist after plugin deletion?
- What is necessary to secure a WP plugin against direct file access attempts?
- How to add img into a plugin?
- Calling a class method instantiated by ajax call in wordpress [closed]
- Using $wpdb in a plugin, what sort of data does it return?
- Custom CSS not being added by plugin
- Plugin generated unexpected output – No PHP errors
- Don’t load the theme for a page FROM a plugin EDITED
- Extending a theme: build new features as plugin or core modules?
- How to set the default value as the saved value once a form of widget is saved?
- Remember the Meta Value With Radio Buttons
- How to access the WordPress DB from a plugin file
- How to use add_action for multiple instances of the same class
- jQuery code didn’t run on my plugin
- How do I show content from a plugin using the template the site is currently working with?
- How to check homepage contain blog post?
- Plugin option default value
- The Events Calendar Plugin – List View Background Colour Issue [closed]
- Every time I de-activate a custom plugin, the site encounters a critical error
- Display my plugins content based on a pages post_id
- How to edit link for comment count
- Create “new pages” within the admin section of plugin
- A question of etiquette when forking a plugin? [closed]
- how to request a script more than once in wordpress
- Select Form Element Not Saving from Plugin Options
- why the wp_register_script doesn’t work for register_activation_hook
- The “Child Pages Shortcode” plugin, block template