0

I have custom "register_post_type" before display data I want to process some data. I cannot found out how to get to data like

add_action('the_post', 'my_function')

Problem that I have is that action the_post works only in "post" don't work in current register_post_type (edit.php?post_type=my_post_type)

I need it for to get array -> collect data -> make curl -> recive data from curl and push in to array exended data

Example more less code what I want to do.


function my_custom_function($posts){

    $my_custom_meta = [];
    foreach($post as $post){
       $my_custom_meta[$post->ID] = get_post_meta($post->ID, 'my_custom_meta', true);
    }

    /** 
     * Make Curl
     */
    $data_form_curl = make_curl($my_custom_meta);

    
    foreach($posts as $post){
       $posts[$post->ID]['data_from_curl'] = $data_form_curl[$post->ID];
    }
    
    return $posts;
}

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.