$row doesn’t look like you think it does. $wpdb->get_results will by default return an array of objects. Your code– 'post_title' => $row['Title']— treats an object like an array and should generate a Fatal Error, which you’d see if you had debugging enabled.
Fatal error: Cannot use object of type stdClass as array in …
You need object syntax. Try (using a Core table):
$rows = $wpdb->get_results( "SELECT * FROM wp_posts");
foreach ($rows as $row) {
// echo $row['post_author']; // doesn't work
echo $row->post_author; // works
echo '<br>';
}
Related Posts:
- Get post ID from wp_insert_post()
- WP insert post and custom taxonomy
- How do I programmatically add items of content to a custom post type?
- Not Able to Insert Taxonomy Term Using wp_insert_post()
- How I upload, save and set a featured image from my frontend?
- Trying to save custom post type from frontend partially working
- wp_insert_post custom taxonomy
- Assign category to front end post
- How can I programmatically save data into custom fields that contain serialized data?
- What hook should be used to programmatically create a post only when master post is updated?
- WordPress tax_input only if logged in
- Programmatically adding posts
- Is it possible to create a post using a metabox?
- How Can I Set the Post Author of a Post I Just Created With PHP?
- How to auto increment post title & post slug field?
- Auto-generated posts not showing in backend (but being counted!)
- wp_insert_post generates endless posts
- create parent post using wp_insert_post
- Cron job for creating posts not excecuting properly
- How to checked selected category checkbox when my custom post inserted from frontend
- Post author for revision not being set on update/insert
- Add CPT values to Database
- Why cant I add a custom post type to a custom taxonomy?
- wp_insert_post wrong post type [closed]
- Programatically inserted posts not showing in Posts Table
- Is it possible to add posts and images (auto resize) for custom post types with a script?
- Update post if exist from PHP
- WordPress hook which triggers on post import
- How to handle new post from API request?
- How to handle this specific case of custom post type?
- insert image with custom post type
- How can I get some of a posts meta data whilst it is still inserting?
- See if the email exists or not
- WP_Insert_Post creating duplicate posts when logged in
- wp_insert_post from XML feed only inserting first post
- What is the correct way that when creating a custom post type assign values to custom fields created with pods framework?
- How do I find out which (page) template file my custom child post is looking for?
- wp_insert_post deleting previous post custom meta
- Published page but it is page not found
- How to insert post 6 times after user register like ask.fm
- wp_insert_post() creates duplicates with ‘post_status’ => ‘publish’
- automatic creation of custom post type articles
- Submitting custom post from frontend,jQuery ajax, and custom validation – can’t find proper place to insert wp_insert_post()
- UPDATED: Save a custom_field value when automatically creating a post using wp_insert_post
- Generate slug and meta data if meta field is empty
- Add a image to a post published on a CPT from the front-end
- wordpress form processing to custom post type not working
- install.php Custom Taxonomy Term not being added to custom post
- Omitted Content After Post-Publish Insertion
- Is this the correct way to add post-slug input field?
- wp_insert_post not working for custom post type?
- After wp_insert_post() custom post type does not show in the admin
- Using wp_insert_post to create custom posts with ACF image field
- Add a post when another post type is inserting
- Custom Post Types: How-to get rid of editor (-meta box)
- How to get template drop down menu in page-attributes of custom post type?
- Set default custom post type for XML-RPC
- Querying custom post type with 2 custom fields (date-range)
- Is it possible to create an “export to PDF” option?
- Add custom field to media attachment image attribute in post editor
- How can you make permalink work for custom post type and taxonomy?
- Too much recursion error when chosing image from image library for two different meta boxes in one post
- Count custom post types with a specific meta value
- The editor has encountered an unexpected error. // TypeError: Cannot read property ‘prefix’ of null
- Post Rank on Single Post page based on custom field
- Customized first post techniques
- WordPress User Roles, Custom Post Types, and Admin views
- Storing Custom Post Type Data in a Custom Table
- `post_type` => `any` not giving me my custom post
- WP_Query that filters based on custom relationship field
- I am having a problem with form updating/editing WordPress post on the frontend
- Adding the taxonomy before the custom post type
- Combine query_posts() and get_posts() into single query
- How do I create filters for custom post types?
- Customize the Dashboard Menu Editor
- I am having Trouble to get list of Categories of Custom post Type
- Set a hard-coded page-template (post-type-archive) as home/front-page of my wordpress blog?
- Displaying tags associated with posts in Custom Post Type
- Using custom post type as taxonomy
- WordPress: Custom User Role cannot access Custom Post Type | “Sorry, you are not allowed to access this page”
- Auto Expire/Delete Custom Post Type Posts after specified time
- Archive Template being used instead of Category Template for Custom Post Type
- How to automatically create a terms based on each post of a post type
- Using `set_transient()` when saving a custom post type
- Add html tot CPT edit screen – no metabox
- Randomizing WordPress Custom Post Type Sorting Through Them Without Page Refresh
- Order posts alphabetically with numbers but some of the posts has numbers in the title
- How to submit the date with ajax?
- Create custom post type categories
- How to get post type archive category title
- Twenty Seventeen customizer front page section: How to use CPT?
- How can i order my posts by post type?
- How to display post thumbnails from custom post type category on homepage?
- Different post types arranged on one page
- the title not working from a custom post type
- What is the proper way implement a global $wp_rewrite?
- Add Metabox to all custom post types
- How to Create a Frontend Html-list Editable in the Backend?
- Same slug for Custom Taxonomy archive and CPT archive – Rewrite rule not working
- WordPress post objects in one parent post object