• Resolved careplacement

    (@careplacement)


    I was sent here from the general support forum by Juan G. a11n (@judagutor) for this question.

    We are using the REST API to bulk add and update products with PHP using the code below (snipped for brevity)
    How can we either update or set the yoast meta data? ie:_yoast_wpseo_metadesc

    $data = buildHomeData($h);
    $woocommerce->put('products/' . $h->prodid, $data);
    
    function buildHomeData($h) {
    global $debug;
    if (!isset($h->HomeType)) { var_dump($h); exit; }
    $shortdesc = "*** Short Desc ***";
    $data = [
    'name' => $h->FacilityName,
    'slug' => $h->slug,
    'sku' => "".$h->id,
    'description' => $h->Web_Notes,
    'short_description' => $shortdesc,
    ];
    return $data;
    }

    Thanks for your help.

Viewing 4 replies - 1 through 4 (of 4 total)
  • @careplacement If you are looking to bulk update your Products meta title, descriptions, focus keyphrase, etc then you can do so from the dashboard interface by going to SEO > Tools > Bulk editor.

    Thread Starter careplacement

    (@careplacement)

    Thank you. That tool will be very helpful in the future. Our goal is to set the meta data offline and upload using the REST API along with the rest of the product details. We actually figured out how to do it, and it wasn’t as difficult as we thought it was. For future reference to anyone else who’s looking for a way to do it, this is what we did:

    $data['meta_data'] = [[ 'key'=>'_yoast_wpseo_focuskw', 'value'=>$h->FacilityName ], [ 'key'=>'_yoast_wpseo_metadesc', 'value'=>$shortdesc ] ];

    Plugin Support Michael Ti?a

    (@mikes41720)

    Hi,

    Thanks for providing your solution as well.

    We also have documentation here for developers for our different APIs in order to manipulate and modify the default data – https://developer.yoast.com/customization/apis/overview

    Plugin Support Michael Ti?a

    (@mikes41720)

    Hi,

    This thread has been marked as resolved to keep the forum overview.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘REST API set yoast meta data’ is closed to new replies.