Title: wp_posts retrieve data, on post_publish
Last modified: August 20, 2016

---

# wp_posts retrieve data, on post_publish

 *  [icantremember111](https://wordpress.org/support/users/icantremember111/)
 * (@icantremember111)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/wp_posts-retrieve-data-on-post_publish/)
 * hi,
 * i need to do the following, and finding help on this here in zurich is proving
   to be a really big issue.
 * anyways, each time an admin creates a new post on his blog, i need to get my 
   plugin to detect this, and then grab all the data from the wp_posts table, and
   send it to our server(backend), the server is going to make some small custom
   alterations to the content and then send it back, and then it needs to get updated
   in the same table.
 * so I’ve been working on this and have the following code,
 *     ```
       function example()
   
       {
   
          $posts = $wpdb->get_results("SELECT ID, post_title FROM wp_posts WHERE post_status = 'publish'
          AND post_type='post'  LIMIT 1")
   
       }
   
       add_action('publish_post', 'example');
       ```
   
 * basically at this stage I’M totally lost, since i just want to get the thing 
   to run when a post is published, and it simple wont work.
    i also need to know
   how to send this to my server(php/mysql)–any links that i can read would be useful.
   thanks, alexei.

The topic ‘wp_posts retrieve data, on post_publish’ is closed to new replies.

## Tags

 * [select](https://wordpress.org/support/topic-tag/select/)
 * [wp_posts](https://wordpress.org/support/topic-tag/wp_posts/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [icantremember111](https://wordpress.org/support/users/icantremember111/)
 * Last activity: [13 years, 8 months ago](https://wordpress.org/support/topic/wp_posts-retrieve-data-on-post_publish/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
