Tuesday, July 12, 2022
HomeWordPress Developmentcustomized submit varieties - Replace worth inside array update_post_meta

customized submit varieties – Replace worth inside array update_post_meta


I’m attempting to alter default values inside array in customized subject.

However I get error “PHP Deadly error: Uncaught Error: Can’t use string offset as an array” when I attempt to change the worth utilizing following code.

Surprisingly I take advantage of this code in default web page template and it really works there once I statiscally present the submit id..

however offers error for following code

add_action('pending_to_publish', 'oj_publish_campaign',10 ,1);

operate oj_publish_campaign($submit) {
    international $wpdb;
    $t = get_post_meta( $post->ID, '_give_donation_levels', true ); 
    $t[0]["_give_amount"] = 25.00;    // getting error right here 
    $t[1]["_give_amount"] = 65.00;
    $t[2]["_give_amount"] = 100.00;
    $t[3]["_give_amount"] = 250.00;
    $t[4]["_give_amount"] = 650.00;    

    update_post_meta( $post->ID, '_give_donation_levels', $t );
}

Can anybody please assist me with this

thanks prematurely

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments