You can technically add a post column with SQL but I’d caution against it as backup scripts, exports etc. would likely ignore it.
Instead, I would add the content as a post_meta, either using a Custom Field or through PHP with the update_post_meta() function.
To fetch a post based on the meta simply use:
$args = array(
'post_type' => 'custom_post_type',
'meta_key' => 'api',
'meta_value' => $api_value,
);
$posts = get_posts( $args )
or, to fetch the value of the API key
get_post_meta( $post_ID, 'api', true );
Related Posts:
- add_meta_box: Datepicker like the one for postdate?
- Multiple information using custom post type
- Adding dropdown select meta box to custom post type – seems restAPI is interfering
- Help Creating a Slideshow Custom Post Type with Custom Meta Boxes?
- How to force one column layout on custom post type edit page?
- Custom Post Type – Taxonomy Dropdown Menu?
- echo value from ‘select’ field type into page template using cmb2?
- WP_List_Table Inside Metabox Not Working on Submit
- Add metabox with media uploader in a custom post type [duplicate]
- How to get custom metabox image field?
- Detect meta value changes when post is updated (post_updated)
- How to hook get_terms() to only show count of posts that have custom meta
- Custom field being erased after autosave
- Order custom posts by a date metabox
- How to select one major category (or custom taxonomy) for a custom post type?
- How to sort CPT by custom meta value (date), and return posts month by month
- Use Custom Post Type as Custom Field
- Saving multiple Metabox contents
- Using ‘strtotime’ function to convert a custom-meta-box to a date-stamp
- Metabox saving values
- Displaying Meta Box Image
- Change Post Title Edit Box
- how to set default value for checkbox in wordpress
- Formatting custom meta box date from YYYY/MM/DD to a more readable alternative
- Before Delete Post
- Display custom post on home page based on a metabox selection
- How to use custom fields to enable sticky posts on custom post types?
- Why do I lose the content of meta boxes when I leave the page?
- Dynamically add / duplicate custom meta in custom post types
- window.send_to_editor and jQuery .attr() conflicts with multiple custom upload image meta boxes
- List of Posts in a Custom Field
- Save an array from drop-down in custom meta box
- Populate Custom Fields in a Custom Post Type?
- Keep display metadata value on backend – Custom Metabox
- How to check if user meta field is empty in conditional else statement
- Why is my select meta data not saving?
- Changing custom type name hides the posts
- Visual editor issue by having multiple tiny mce editors in a CPT
- Found 2 elements with non-unique id (#_ajax_nonce) and (#_wpnonce)
- Add custom field to Posts and sort by it
- A better way to add a meta box to custom post types
- Plugin – Combine Meta Box Input Fields into single saveble record
- Two Custom Post Types Many to Many Relationship
- Meta Query Filtering not working on Custom Meta Box using Radio Buttons
- Grouping metadatas into one
- Repeatable Fields Metabox with Textarea (or wp_editor)
- How to use TinyMCE Editor for one of my custom post meta field?
- Cannot save CPT meta box
- Adding Page Templates to post but it ignored it
- Custom “radio button meta box” not saving correctly
- Add additional field to custom post_type
- Custom Post Meta from custom metaboxes is randomly being deleted
- Add a custom meta box for client to order CPT posts how they want
- Display Repeatable Meta Box Content
- What do the numbers mean at the end of add_action(‘save_post’)…?
- A meta box (in a custom post type) with two different type of fields
- Reusable metabox backend and frontend
- Get custom term meta problem on single post type
- Display custom meta on page that has been check in custom post type
- How can I output WPAlchemy repeating fields meta values in my page template?
- How can I modify a custom post type and custom page template for a child theme if all content seams to be handled by theme’s ‘native’ plugin?
- Adding an extra parameter [string] to my posts’ permalink?
- Problem On Retrieving Post Meta Data on Custom Column [closed]
- Making a form for user to add new custom post with custom taxonomies and custom fields
- Empty meta-box returns publishdate if no value is set?
- Saving metabox keys and storing values as array
- Custom Post Type Meta Box Text Input Field Won’t Save When Blank
- Checking for custom field in admin pages
- A sports wordpress website
- Display custom post front end filter by ACF equals current user
- Custom Post Type meta data getting deleted on bulk editing taxonomies
- How to display custom field in product description?
- How to avoid duplicate posts queried from custom meta?
- Custom Metabox Info Not Saving
- PHP Warning with Custom Fields
- $_POST from a Meta Box
- Simple Data picker meta box
- check_admin_referer not working in custom meta box for custom post type
- WP_posts (Not meta) extra custom field column show and change it in a custom post type
- Avoid another meta box in my custom post type
- Delete custom post type metadata without deleting the post in admin area
- Search form to find custom meta box generated data
- Calling specific page with wp query
- How to make post page unique and show it on home page?
- Edit post meta direct from post.php?
- How to Arrange Support => Thumbnail
- Display a post count from a custom metabox selection
- custom field suit new post with in custom fields
- Filter CPT based on meta box value using Flexible Posts widget?
- Textarea type on one field custom add_meta_box?
- WP_Query arguments: Loop through custom post type – get all entries except excluded meta_key?
- loop through custom post-type with two meta_keys
- Extending a CPT by Created by another plugin
- Custom meta box includes
- Creating entries with image attachements within posts and managing them in a list
- Custom Post Type + Custom Meta Query Not Showing 2012 Posts
- Adding a custom “Add Custom Field” button to Custom Meta boxes
- Display div based on Group metabox selection [closed]
- Display code if title of the custom post matches title of other post
- How to consume external API from WordPress post editor and display the response data in the custom field?