Articles of wp insert post

duplicate entries in database while using save_post or wp_insert_post

Here is what I am trying to do – I have created a custom table in the database and I am trying to enter data into it everytime a post is created. The database-entry needs to happen ONCE AND ONLY WHEN A NEW POST IS CREATED. NOT on post-update, revision, status-change etc. FYI, new posts […]

Create Post Using Form on WP Dashboard

As always, I have unique situations and client requests. I am working on a custom dashboard widget that will include a form to register for an event. Once the form is submitted, it will generate a custom post type of invoice. Currently, I’m just playing with the basics to get things working. So here is […]

oEmbded with wp_insert_post()

I try to add articles via wp_insert_post but as it seems the oEmbed function of WordPress doesn’t work properly. I work with embedly as you can embed any website. I realized that the oEmbed functionallity is triggered after saving the post in the WordPress-Backend. Can i trigger the Embed somehow programmaticly? Wrap the URL with […]

Get Post ID after front end post submission

I can’t get the published post ID, i’m using a front end custom form. When the submit button is clicked site is re directed to a different page. Now, i can’t get the just published post ID using: wp_insert_post($post) Because it returns the ID of redirected page instead of the published post. How can i […]

Create Page With wp_insert_post() and AJAX

I’ve been trying to figure out how to create a post (or any custom post type) with wp_insert_post() and AJAX…so far to no avail. What I hope to achieve: Any user (not just logged in ones, I don’t want to mess with permissions for now) can create a post To create the post I only […]

Programatically inserted posts not showing in Posts Table

I’m trying to insert a custom post through a form. It’s a brief post, most content are custom meta fields updated with add_post_meta. So far, post inserting is working fine, except for a detail. This is the post insert query I’m doing: $venta = wp_insert_post(array( ‘post_name’ => “venta-$stamp”, ‘post_title’ => “Venta $stamp”, ‘post_type’ => ‘venta’, […]

Creating posts from API data, how to identify posts already imported?

As the title says, I’m using an API to fetch some data which is used to create CPT posts, and need to identify items returned from the API which have already been inserted as posts. The API returns unique IDs for each item, which naturally leads me toward just making use of the GUID column, […]

Create one-use post dynamically, add to main query, do not insert post (user profile view)

I’m trying to create my own user profile pages. When someone requests, I want to query the user tables for a user with username (= slug) and display the result. Ideally, I would alter the main query to query only the user tables and return this result. This does not seem to be possible […]

Auto-generated posts not showing in backend (but being counted!)

I have a custom post type with a custom backend page. I’m creating posts of that type using this code: $postarr = array( “post_type” => “product_settings”, “post_status” => “published”, “post_title” => “$ean $name”, “post_content” => “$ean $name”, // to satisfy WP requirement “meta_input” => array(“ean” => $ean) ); $id = wp_insert_post($postarr); if (!$id) echo “ERR: […]

$user_id = wp_insert_user( $userdata ) Not working no errors

Below insert of new user does not work. I have no idea why not. There are no error messages send to debug.txt or to screen. I have also checked a bunch of thread about this insert. But it seems my code should be correct. But not working. What do I do wrong in this code? […]