$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
- How to disable generation of default image sizes for some custom post types?
- How To Remove These Stuffs From Custom Post Type List Screen?
- Exclude a category from WP_Query
- Hierachical Custom post types permalinks not working
- TV Show database – Best way for structuring it?
- Get post info inside modal window?
- Custom Post Type single and archive pages are not working
- is_singular just won’t work [closed]
- remove permalink “front part” for custom post type
- Display custom fields on post excerpt or teaser
- Getting a PHP Notice when using Pods with WPML [closed]
- Extending AZIndex plugin to use custom post types and custom taxonomies
- wordpress wp_list_pages help
- How to display custom taxonomies with links in filter menu?
- Rows with custom columns not well formatted after Quick Edit save
- Permit users with author role to edit a custom post type
- I don’t understand why use array inside the add action hook to create custom post type using object oriented way
- Enable taxonomies by post type in an array of CPTs
- Hide specific taxonomies from a taxonomy list using ‘get_object_taxonomies’
- Targeting categories in custom fields
- Custom pages missing on “front page” setting
- Display post from custom post type
- Multiple archives to display parent and subcategories content
- unapprove comments on custom post type
- Can’t pull posts of a Custom Post Type based on the custom taxonomy of the CPT
- Custom taxonomy permalink without term, redirection to CPT slug
- How do I troubleshoot pre_get_posts with Debug Bar?
- WP_query has incorrect wp_posts.post_name = ‘asc’ when I have custom post type called ‘order’
- How to only get the content of post page while looping?
- How to add badge “new” to the post title which are showed in recent post widgets in wordpress
- edit.php all post not working
- Parent child relation between Post and Page
- How to save post title before publish?
- WooThemes – Vendors / Bookings – Allow Vendors to manage resources
- URL with Hierarchical Taxonomies and same slug for all terms and sub-terms
- WP Query with multiple post types ordered by custom meta date then published date
- Custom Post Types and rewrite rules – One CPT works and a cloned one doesn’t
- Sort a custom post type loop by a custom taxomomy instead of chronologically
- Add custom taxonomies as class names to an archive page of custom post types
- WordPress URL Problems and Layout
- Querying meta values within an array
- How to add custom column to Custom post page list?
- Rewriting hierarchical post type
- wordpress category form fields in popup
- How can I show posts with the same tag?
- How Do I Add a Custom Post Type URL to Content?
- What is the best way to relate different custom post types?