Try this:
function returncartdata($data) {
$return = '';
foreach ($data as $carthtml => $itemhtml) {
$return .= $itemhtml[0];
$return .= $itemhtml[1];
$return .= $itemhtml[2];
$return .= $itemhtml[3];
$return .= $itemhtml[4];
}
return $return;
}
$rawhtmlcartdata = cart_items_array();
$ordercart = returncartdata($rawhtmlcartdata);
wp_insert_post(array (
'post_type' => 'saved-orders',
'post_title' => 'Test',
'post_content' => $ordercart,
'post_status' => 'publish',
'comment_status' => 'closed', // if you prefer
'ping_status' => 'closed', // if you prefer
));
Related Posts:
- How to update custom fields using the wp_insert_post() function?
- PHP/Manual use of images? – 2 Questions
- Set Primary category using the Yoast SEO plugin
- wp_insert_post not working
- wp_insert_post() is returning the correct post ID, no failure, but the post content does not get updated
- Can’t get wp_insert_post to work
- Auto-Select Parent Category as Primary
- Don’t insert if permalink is the same?
- Use of wp_insert_post and parameters
- Getting error when using wp_insert_post()
- wp_insert_post() with HTML tags using PHP
- Add new post in existing categories using wp_insert_post
- get post id from wp_insert_post for get_template_part
- Generate CSV file and add data as a new wordpress custom post
- How to use `wp_insert_post()` and `get_permalink()` functions?
- how to add datas in taxonomy to post with wp_insert_post
- How can I pass php code as a content while publishing a post
- Meta inserted through wp_insert_post gets messed up
- how to call other plugins once custom post has been inserted
- Adding user meta to post meta wp_insert_post() not working
- Front end post submissions do not get submitted in the category
- Post content not showing some content
- upload images on front by user using form
- Create and publish a new post every Monday, listing the post titles and links to the posts published during the previous week
- PHP – Multiple variables in insert post array
- Can’t send form data to wpdb when URL has query string
- Can’t insert into a database wordpress
- How to get the custom header image’s alt text?
- PHP unit testing WordPress?
- Is there a way for a plugin to add an attribute to the tag of a theme?
- wp_set_object_terms and arrays
- How to create custom php script page
- Metabox repeating fields – radio buttons not saving correctly
- Create WordPress pages with PHP
- How do i hide the if the appears
- How to return the_excerpt (without echo)?
- Replacing mysql_real_escape_string in WordPress theme
- WordPress 4 invalid username special charachters issue
- My shortcode is showing up twice
- Database “Migration” for Plugins?
- using woocommerce_template_single_add_to_cart in shop-loop – javascript issues [closed]
- How do I test PHP files in WordPress?
- echo CHILD / SUB CATEGORIES of the CURRENT CATEGORY only
- ACF check if variable has http, if else return string
- Correct syntax to html php conversion
- Adding a div at the bottom of a sidebar
- How to display data from custom table in wordpress phpmyadmin
- how do I get a specific post from a post with a subcategory in WP
- PHP Fatal error: Out of memory in WordPress [closed]
- Theme developement – incative sidebars
- Scrape external webpage for first image and add it to new post
- Help solving t_echo php error while using echo do_shortcode
- How i can get post data from database when i am getting post id from url in wordpress
- Hook called before text widget save
- meta box not display data input in the textarea
- wpdb prepare insert table doesn’t work
- How to modify the default feed via a function
- dynamic page using php from sql database
- Loop over Array and get the distinct ids
- Store metakey value as an array
- How do I change this function from two returns to one string to show sku and dimensions in WooCommerce cart?
- How to get all the items of a taxonomy even if it does not have a custom post type?
- Displaying Overlay images over thumbnail of category type?
- Uses for function: wp_update_user
- PHP: $_SESSION destroyed after page reload for my custom session
- Wp Query : Order by distance lat,lon
- How can I check if a post with a particular slug or title exists?
- problem connecting to the administrator
- How do I integrate vanilla Javascript to a wordpress website?
- I want to retrieve the email or username data entered for password reset, but failed. how can I do it?
- Force Sidebar on Full Width page
- Exclude category from function – PHP
- ACF – Can’t get custom post type by taxonomy
- Update user meta when an external link in admin notice is clicked
- How to count posts posts if they are in a separate content page?
- Ajax in a class instantiated via shortcode
- append data to mysql table via submit button coded in php – not working
- PHP – Woocommerce 3.2 Add variable shipping insurance with multiple “else if ” conditions
- Why transition_post_type hook is called twice for the same post?
- Shortcode Works for Logged in Users but Not Working for Guest
- Fix mod_pagespeed Fetch timed out error on bitnami AWS wordpress installation
- Adding my own custom template page but got white page
- How to set max users to 17.000
- Facebook like update status for wordpress
- wordpress form processing to custom post type not working
- WordPress will suddenly stop saving files uploaded by my code (ran in nopriv ajax)
- Permission error on plugin save
- Adding javascript files to WordPress and jQuery version
- Display default WordPress login/registration form into a modal window
- WP Login Button for current domain
- Pull GET parameter from URL in functions.php
- How to NOT override inline css rules
- Adding Gravity Form With if(is_page) Is Not Working
- Implement “No related posts for this entry” into the loop?
- Twig+WordPress how to use array arguments inside a function?
- I would like to alert message while another user is editing or update data in wordpress admin panel, what should i do?
- Understanding responsive imagery
- How to get meta box labels?
- get_query_vars always retruns empty value
- How to group by column a and sum column b and c in a php array