• hi,

    I uploaded a post programmatically, everything works absolutely fine.
    Am using
    update_post_meta( $post_id, ‘fifu_image_url’, $url);
    which uploads the image but does not display it unless i click update and preview. My plan is to upload multiple products through a plugin so it’s not going to be an easy task updating each of them, is there a way that they get updated automatically?

    thank you.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author fifu.app

    (@marceljm)

    Hi, @advanztek.

    Take a look at FIFU Settings > Help > DEV. Let me know if that solves the issue.

    Thread Starter advanztek

    (@advanztek)

    i’ve done that but no change, am actually trying to upload product image.

    • This reply was modified 5 years, 5 months ago by advanztek.
    Thread Starter advanztek

    (@advanztek)

    @marceljm could it be because am using a free version?

    Plugin Author fifu.app

    (@marceljm)

    Hi, @advanztek.

    i’ve done that but no change

    You have done what?

    actually trying to upload product image.

    FIFU doesn’t upload images. It works with EXTERNAL images. Please read FIFU Settings > Help > Getting Started.

    Thread Starter advanztek

    (@advanztek)

    That’s exactly what i mean, everything is working fine, it’s just that i have to click Publish/Update button before the image displays in the front end, can this work automatically without me clicking Publish/Update button?

    this is my code

    $string = “Air Filter”;

    $slug = strtolower(trim(preg_replace(‘/[^A-Za-z0-9-]+/’, ‘-‘, $string)));

    $product_array=array(
    ‘post_title’ => ‘Air Filter’,
    ‘post_content’ => ‘Air Filter’,
    ‘post_status’ => ‘publish’,
    ‘post_type’ => “product”,
    ‘comment_status’ => “opened”,
    ‘post_name’ => $slug,
    );

    // Create a simple WooCommerce product
    $post_id = wp_insert_post( $product_array );

    // Setting the product type
    wp_set_object_terms( $post_id, ‘simple’, ‘product_type’ );

    wp_set_object_terms( $post_id, 69, ‘product_cat’ );

    $url = “https://WWW.SHOWMETHEPARTSDB2.COM/BIN/IMAGES/BOSCH/5437wsangle01.jpg”;

    // Setting the product meta
    update_post_meta( $post_id, ‘_sale_price’, 80 );
    update_post_meta( $post_id, ‘_price’, 136 );
    update_post_meta( $post_id, ‘_featured’, ‘yes’ );
    update_post_meta( $post_id, ‘_stock’, ’23’ );
    update_post_meta( $post_id, ‘_stock_status’, ‘instock’);
    update_post_meta( $post_id, ‘fifu_image_url’, $url);

    Thank you.

    • This reply was modified 5 years, 5 months ago by advanztek.
    Plugin Author fifu.app

    (@marceljm)

    Hi, @advanztek.

    You should use
    fifu_dev_set_image($post_id, $image_url)
    instead of
    update_post_meta

    Thread Starter advanztek

    (@advanztek)

    Thank you @marceljm, it worked like magic

    Plugin Author fifu.app

    (@marceljm)

    Great, @advanztek!

    If you think all are working fine and you don’t have other issues, please give FIFU a nice review. Thanks!
    https://ww.wp.xz.cn/support/plugin/featured-image-from-url/reviews/

    Thread Starter advanztek

    (@advanztek)

    For sure i’ll five stars for you.

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Image does not display unless i update’ is closed to new replies.