While I am a big fan of tweaking wordpress as much as it could because it allows us to, I think the best way forward is to have the best algorithm before coding.
Reading your question, I came across ” Actually, I have created two custom post type named 'truck' and 'drivers'
“.
Issue: Linking two post types requires extra work as you are doing because natively it is not what WordPress does.
Suggested Solution: Do it, the way WP works naturally: Link a Custom Post Type to a taxonomy
. So, instead of having ‘truck’ and ‘drivers’ as CPTs, have ‘drivers’ as CPT and ‘trucks’ as taxonomy! That saves you tons of work, and especially the risk of running into issues should WP Update.
You can then create the custom functionality of dragging and dropping on CPT and taxonomy
Related Posts:
- Where are wordpress custom types stored?
- Right way to store a large set of similar information on website? [duplicate]
- Delete all posts of a custom post type—efficiently
- Order by & include array by specific post ids
- Get list of all registered post types slugs
- Custom Post Types, or completely custom?
- Custom Post Type with Input fields to seperate table on database.
- How to use custom database tables for custom post types?
- Custom post type or just use custom fields
- How do I write this SQL statement for Posts written in last 24 hours?
- update a post meta from a single table cell TablePress
- update custom post type meta from a shortcode
- Custom post type Vs. data in own table
- Using posts and postmeta table to store custom Address Book Plugin data
- How to use custom post type APIs, but use a different db table
- Developing WordPress on Kubernetes
- WordPress post count not showing for custom post type author
- Create a post in custom post type using field in registration form after users submit form
- Adding custom tables to WordPress
- My theme saves their custom post type’s metadata as a serialized array, how to access the keys?
- Sorting custom post type columns with external data and without meta values
- How to use custom taxonomies to reference complex relationships?
- How to store multiple values in 1 meta_key with radio input?
- Display a CPT based on a metabox selection
- Database to page routing API?
- Store CPT ‘Reviews’ average ratings to a WordPress DB table or to a DB custom table?
- How to handle a CSV with 65,000+ rows and make it searchable?
- How to change wp prefix for custom post type only?
- Is it possible to store Custom Post Type data in separate set of tables and still have wp_post class functionality?
- Add update or delete database records using custom post type
- How to import a custom MySQL DB table into a WordPress custom post type
- Storing a many to many post type relationship in post meta and keeping SQL ability for Joins
- Limit the post for differents custom post type in the same wp_query
- Importing Data from a Non-WordPress database, into WP
- How to organise this data within WordPress
- Show data from one Custom Post Type in another Custom Post Type
- Custom Post Types — $args vs. labels array
- Get an array wich contains the post_name of every post that has the custom post_type “pelicula”
- Specifying meta field’s column type in Database using add_post_meta
- Add first letter of titles to array, then compare arrays
- Is it a good idea to add a column to the posts table?
- Replace dynamically content in a custom database table when a custom post is created
- Query Custom Post Types with checkboxes
- Save and user submitted data from a form and display them in the wp backend
- Dump custom post type database
- Inefficient Query Confusion
- Querying multiple values from a single key
- Check if user has comment on current post
- Update all published posts at once
- get_terms() returns Trying to get property of non-object error for custom taxonomy
- How do I disply an array inside a custom post type?
- Getting custom post types to properly display alphabetically
- Ideas to connect external database table to wordpress posts as custom field source
- WordPress as a frontend website for iOS app [closed]
- Using custom post types WordPress network
- custom post type: own database table structure and custom “new-post” interface
- Say I have a tech blog, how best would I store technical specs for a phone, if i use custom post types
- How can I loop at a Specific Taxonomy from a custom post type?
- Update value inside array update_post_meta
- Having a repeating custom field in admin custom post type, what I’d go better with, for DB’s sake? ACF repeater or query a different post type?
- Custom archive page for custom taxonomy and pagination issue
- Clone wp-admin/users.php (Users Admin Page)
- Get an array of the number of post per year of a custom post type (WordPress)
- when looping through custom post data not appearing
- custom post types, custom fields and normalization
- Create 3 Levels of relations with WordPress
- Exporting Post type from one theme and importing it to another theme
- Staggering featured post using ‘sticky’
- How to replicate data storage and querying using WordPress. Custom posts/fields or Custom db tables?
- custom data model – link and populate from admin backend
- Confused about where to store my data
- Changing an item in drop down after 5 latest posts per taxonomy
- Populate custom post type/custom fields from an external database
- Automatically convert standard posts with custom fields to custom post types
- In WordPress do I create tables for my plugin or do I create custom post types for a Student and Classes Registration system?
- CPT or Custom Table for Repository of Serial Numbers
- Trying to get custom post type attachment images to function in indexed array
- How to use TOC with ACF?
- How to enable the user to add value through the admin panel?
- Use Tags to Query Associated Multiple Posts and Get The Average Of Custom Field Values
- Shared Custom post type between WP network sites
- WordPress custom field images not getting inserted into array
- Meta-Box to add multiple items one at a time and on publish save all
- Pulling Content from Existing Database
- Displaying database table in backend of wordpress
- custom post type for custom talbe
- Custom Post Type Author Array Problem
- taxonomy terms array not working
- Display custom posts in checkbox list
- Check in function on custom page
- posting twice from an array?
- Inserting into WP DB
- What is the most efficient way to manage changes my product comparison tables?
- WordPress and Unity high scores table
- Checking for published posts in a certain post type
- custom post types containing a collection of items
- WordPress Admin Page Slow. Customer Post Type is the slowest
- Display custom post type attached media file sizes
- What would be the optimal CPT / Taxonomy design for the following entities structure
- post__in select all custom posts and not the selected array of ids