• Resolved andycty611

    (@andycty611)


    I’m having an issue where wp_remote_post runs 3 times but is in the code once. I added the code to the “Posts” tab in the “Before the post content”.

    Here is part of the code:

    <?php
    $postID = get_the_ID();
    $array_with_parameters->blog_id = $postID;
    $args = array(
        'headers' => array(
            'Content-Type' => 'application/json; charset=utf-8'
        ) ,
        'body' => json_encode($array_with_parameters) ,
        'method' => 'POST',
        'data_format' => 'body'
    );
    
    $url = 'https://apiendpointgoeshere.com';
    $response = wp_remote_post($url, $args);

    Can the plugin prevent wp_remote_post from running 3 times? I tried echo to show output but the output shows up once.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Stefano Lissa

    (@satollo)

    Hi, sorry but I’m not understanding your problem. Can you explain me better? Is the code of your request custom code? Where is it used?

    Stefano.

    Thread Starter andycty611

    (@andycty611)

    I was able to fix the issue by using $_SESSION, I realized it wasn’t an issue with the plugin

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘wp_remote_post runs 3 times with plugin’ is closed to new replies.