php - Run function on posts sequentially -


I have the following (resource intensive) functions that I'm triggering on the save_post operation when I save or edit a single post then it works perfectly The problem is that I have to use it when importing multiple posts at the same time. I believe this function is running in all imported (saved) posts at the same time.

How can I use the save_post operation but only this post can be executed on each post sequentially?

Prefix function getYouTubeTags ($ post_id) {/ if there is a tag in the post, close it (is_trum ('', 'post_tag')) {return; } $ Out = null; $ Video_id = get_post_meta (get_the_ID (), 'rfvi_video_id', true); $ Tag_url = "http://www.youtube.com/watch?v=" $ Video_id; $ Sites_html = file_get_contents ($ Tag_ultral, empty, empty, 700, 7000); $ Html = new DOMDocument (); @ $ HTML- & gt; LoadHTML ($ sites_html); $ Meta_og_tag = null; Foreign Currency ($ html-> getElementsByTagName (meta) as the Meta) {if ($ meta-> getAttribute ('Properties') === 'and: Video: Tag') {$ meta_og_tag = $ Meta-> and; GetAttribute ('content'); $ Out [] = $ meta_og_tag; }} If (! Blank ($ out)) {return implode (',', $ out); } And {return; }} // To post the function add the YouTube tag rct_save_post_terms ($ post_id) {$ terms = getYouTubeTags ($ post_id); Wp_set_post_terms ($ post_id, $ word, 'post_tag', true); } Add_action ('save_post', 'rct_save_post_terms', 110, 1);


Comments