Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PASTEBINnew pastetrends API tools faq
- search...
- herculesnetwork
- I got a solution on a page of my index.php in a testing domain, where I just create index.php files and testo my codes, I wrote a solution that the entire embed destroyed by strange symbols, is fixed by symbols written correctly, <> "& Not those strange codes" srsrsrs
- But this has to be applied in the post_content after it creates the post
- `
- $post = array(
- 'post_author' => '1',
- 'post_status' => $_POST['status'],
- 'post_type' => $cpt,
- 'post_title' => (string) $feed_item->title,
- 'post_content' => (string) $feed_item->desc
- );
- $post_id = wp_insert_post( $post );
- update_post_meta($post_id, 'sponsor', (string)$_POST['source']);
- update_post_meta($post_id, 'videoID', (string)$feed_item->id);
- // hercules arrays:
- $myembeddirty = array('ID:','<','"','&','>'
- );
- $myembedcleaner = array('','<','"','&','>'
- );
- /*
- From now on, clearly I do not know what I'm doing srsr
- I do not know how to call by post_content above, would it be with $ post_content?
- I suffer with this case, because cron has a minimum of one hour, and I already used grep
- From linux to see if I can find the code to slow this time I can not!
- So every new try I have to wait an hour to see if it works!
- */
- // $post = get_post( $post_ID );
- // $post->post_content;
- /*
- THE SOLUTION:
- //$mynewdesc = $post->post_content;
- //$mynewdesc = str_replace($myembeddirty, $myembedcleaner, $mynewdesc); //this solve the PROBLEM do embed breaked from htmlentities, but I don't know apply in $post_content
- */
- $prev = get_post( $post_id );
- $prev->post_content = $post->post_content;
- $prev->post_content = str_replace($myembeddirty, $myembedcleaner, $prev->post_content);
- wp_insert_post( $prev );
- // $post = array(
- // 'post_content' => $post->post_content,
- // );
- // wp_insert_post($post_id);
- `
- RAW Paste Data
- I got a solution on a page of my index.php in a testing domain, where I just create index.php files and testo my codes, I wrote a solution that the entire embed destroyed by strange symbols, is fixed by symbols written correctly, <> "& Not those strange codes" srsrsrs
- But this has to be applied in the post_content after it creates the post
- `
- $post = array(
- 'post_author' => '1',
- 'post_status' => $_POST['status'],
- 'post_type' => $cpt,
- 'post_title' => (string) $feed_item->title,
- 'post_content' => (string) $feed_item->desc
- );
- $post_id = wp_insert_post( $post );
- update_post_meta($post_id, 'sponsor', (string)$_POST['source']);
- update_post_meta($post_id, 'videoID', (string)$feed_item->id);
- // hercules arrays:
- $myembeddirty = array('ID:','<','"','&','>'
- );
- $myembedcleaner = array('','<','"','&','>'
- );
- /*
- From now on, clearly I do not know what I'm doing srsr
- I do not know how to call by post_content above, would it be with $ post_content?
- I suffer with this case, because cron has a minimum of one hour, and I already used grep
- From linux to see if I can find the code to slow this time I can not!
- So every new try I have to wait an hour to see if it works!
- */
- $post = get_post( $post_ID );
- $post->post_content;
- /*
- THE SOLUTION:
- //$mynewdesc = $post->post_content;
- //$mynewdesc = str_replace($myembeddirty, $myembedcleaner, $mynewdesc); //this solve the PROBLEM do embed breaked from htmlentities, but I don't know apply in $post_content
- */
- $post->post_content = str_replace($myembeddirty, $myembedcleaner, $post->post_content);
- $post = array(
- 'post_content' => $post->post_content,
- );
- wp_insert_post($post_id);
- `
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement