Advertisement
herculesnetwork

my best try

Apr 1st, 2017
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. // hercules begin
  2. $myembed = htmlentities( (string)$feed_item->embed );
  3. $feed_item->desc = "ID:<h2>{$feed_item->title}</h2><br>\n{$myembed}<br>\n{$feed_item->desc}";
  4.  
  5. /* hercules closer */
  6. $post = array(
  7. 'post_author' => '1',
  8. 'post_status' => $_POST['status'],
  9. 'post_type' => $cpt,
  10. 'post_title' => (string) $feed_item->title,
  11. 'post_content' => (string) $feed_item->desc
  12. );
  13. $post_id = wp_insert_post( $post );
  14. update_post_meta($post_id, 'sponsor', (string)$_POST['source']);
  15. update_post_meta($post_id, 'videoID', (string)$feed_item->id);
  16. //hercules begin
  17. $myembeddirty = array('ID:','&lt;','&quot;','&amp;','&gt;'
  18. );
  19. $myembedcleaner = array('','<','"','&','>'
  20. );
  21.  
  22. $prev = get_post( $post_id );
  23. $post->post_content = str_replace($myembeddirty, $myembedcleaner, $post->post_content);
  24. $prev->post_content = $post->post_content;
  25. wp_insert_post( $prev );
  26.  
  27. $post = array(
  28. 'post_content' => $post->post_content,
  29. );
  30. wp_insert_post($post_id);
  31. // hercules closed
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement