Title: Changing Post Data with Function
Last modified: August 20, 2016

---

# Changing Post Data with Function

 *  Resolved [fatalx](https://wordpress.org/support/users/fatalx/)
 * (@fatalx)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/changing-post-data-with-function/)
 * Hello,
 * I would like to find out how I could change the post_status and post_date from
   inside a function (plugin).
 * I have used wp_insert_post_data to edit the post_status and post_date before 
   but now I need a scheduled event that will call a function and that function 
   must change a posts status and date.
 * Any idea how this could be done?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [NateJacobs](https://wordpress.org/support/users/natejacobs/)
 * (@natejacobs)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/changing-post-data-with-function/#post-2292205)
 * You will want to research WordPress implementation of cron jobs. You can read
   how to schedule an event in the [Codex](http://codex.wordpress.org/Function_Reference/wp_schedule_event).
 *  Thread Starter [fatalx](https://wordpress.org/support/users/fatalx/)
 * (@fatalx)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/changing-post-data-with-function/#post-2292425)
 * I ended up fixing my issue by using the $wpdb global and changing the post_status
   directly in the database. Thanks

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Changing Post Data with Function’ is closed to new replies.

## Tags

 * [change](https://wordpress.org/support/topic-tag/change/)
 * [post data](https://wordpress.org/support/topic-tag/post-data/)
 * [post_status](https://wordpress.org/support/topic-tag/post_status/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [fatalx](https://wordpress.org/support/users/fatalx/)
 * Last activity: [14 years, 8 months ago](https://wordpress.org/support/topic/changing-post-data-with-function/#post-2292425)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
