Can't publish post using ajax

I have an issue,i create three input in frontend(title,body,and name) I process the value using wp-ajax,and in m

I have an issue, i create three input in frontend(title, body, and name)

I process the value using wp-ajax, and in my ajax function I use wp_insert_post to create a new post.

if I put 'post_status =>' publish' in my wp_insert_post, I get error 500 in ajax-admin, but if I remove it my code is fine.

I want create a post with publish status. I also already put wp_publish_post after wp_insert_post in same ajax-function. but also getting 500 error.

Is there any solution for this issue?

I have an issue, i create three input in frontend(title, body, and name)

I process the value using wp-ajax, and in my ajax function I use wp_insert_post to create a new post.

if I put 'post_status =>' publish' in my wp_insert_post, I get error 500 in ajax-admin, but if I remove it my code is fine.

I want create a post with publish status. I also already put wp_publish_post after wp_insert_post in same ajax-function. but also getting 500 error.

Is there any solution for this issue?

Share Improve this question asked Jan 23, 2019 at 10:30 Diana RiderDiana Rider 4911 bronze badges 3
  • 1 Please include the actual code in the question, otherwise it’s impossible to know what the issue is. Based on your description though my guess is that you’re missing a comma after the line you’re adding. – Jacob Peattie Commented Jan 23, 2019 at 10:35
  • 'post_status =>' publish' should be 'post_status' => 'publish' – shanebp Commented Jan 25, 2019 at 15:27
  • I also experienced the same, not sure how it came up like this, it just suddenly happening. – Ryan S Commented Aug 23, 2019 at 13:23
Add a comment  | 

2 Answers 2

Reset to default 1

To those who are experiencing the same issue, there are few steps to take to determine the culprit.

  1. Create posts manually in the WP Dashboard area (set it to future)
  2. .. and manually publish (look for the error in the log).
  3. step 1 and trash the post, in the Trash, try reverting that post (this generally create a log, and a log is all we need in this case).
  4. Check for any plugin which filters the post publish.

Hope this helps

To troubleshoot WordPress errors, you require to enable WordPress Debug, which can be done using wp-config.php. You need to copy and paste the code in wp-config.php file shown below. define( 'WP_DEBUG', true );

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745221795a4617281.html

相关推荐

  • Can't publish post using ajax

    I have an issue,i create three input in frontend(title,body,and name) I process the value using wp-ajax,and in m

    6小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信