New answers tagged

4

This part of wp_insert_posts() gives it away: if ( ! empty( $postarr['meta_input'] ) ) { foreach ( $postarr['meta_input'] as $field => $value ) { update_post_meta( $post_ID, $field, $value ); } } where we see how the post meta fields are updated/added with update_post_meta(). Here's the inline description for ...


0

I am using a custom_function() to insert the post, the form redirects the user to a different page, that page has it's own ID and that's why I couldn't get this to work. In my case worked declaring this in my template: if( $_POST) { $post_ID = custom_function(); } Then i can use $post_ID to get the custom data I needed from that post.


1

wp_insert_post() returns either one of three things the newly created post's ID a WP_Error object if $wp_error is set to true if an error occured during post insertion in which case the post is not inserted 0 if $wp_error is set to false (default) if an error occured during post insertion in which case the post is not inserted The following should work ...


2

I don't know why you would want to exclude hooks as a possible solution, because I still think this is the best option OPTION 1 - without hooks To make this work, the specific URL you want to use must exist and must not return a 404. I probably think your best option here would be to create a private page and add your code directly into a specified ...


1

I was just thinking about your support ticket when I found this question, thanks for letting us know about this. I work at Embedly and am the primary author of the embedly plugin. I'm pretty sure @jgraup is correct that you need to utilize the wp_oembed_get function (this is called automatically when editing in the tinyMCE post editor). If you're using the ...


0

Read up on Embeds. To trigger an embed use wp_oembed_get($url). In general the url needs to be on it's own line with a space below and above when inside the_content. wp_insert_post() has nothing to do with embeds as the embed HTML is usually generated when passed through the_content filter. To add support for non-oEmbed sites use ...



Top 50 recent answers are included