• Hello,
    I use your very helpful plugin in custom post types which are currently imported from external feeds and inserted via wp_insert_post().
    The problem ist, that star rating doesn’t appear until I once visited the posts edit page and resaved the post. Is there any way to activate it without visiting every single posts edit form?
    I already tried to update the post automatically with wp_update_post()
    and I also tried to set a value via update_post_meta() – no success yet.
    Can you give me a hint, how initialization works and how activation could be performed as update-query?
    Thank you very much,
    Melanie

    https://www.ads-software.com/plugins/acf-starrating/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author lienann

    (@lienann)

    Hi,
    If I understand your problem:
    1. use the field_key to display rating (you can using field_name, if reference for a value already exists)
    or
    2. try to use update_field() function (with “0” value, with field_key) after wp_insert_post(). See ACF docs: https://www.advancedcustomfields.com/resources/update_field/
    I hope this may help you… ?

    Thread Starter F2 Melanie

    (@f2-melanie)

    Thank you.
    Unfortunately, it does not help, because the field key is not available before the post was once resaved. I can print out any other custom fields via get_post_custom_keys or get_post_meta but the star rating field needs, as it seems to me, to be instanciated first. This happens when resaving the post.
    After resaving I then get the following:
    [_edit_lock] = Array([0] => 1430378890:2)
    [_edit_last] = Array([0] => 2)
    [bewertung] = Array([0] => a:2:{s:4:”avrg”;s:1:”0″;s:5:”votes”;s:1:”0″;})
    [_bewertung] = Array([0] = field_5538eb70a2a4f)

    The field key now seems to be this one “field_5538eb70a2a4f” – but it is not available before.
    Do you understand me?

    Plugin Author lienann

    (@lienann)

    I can’t understand why the field key is not available.
    Can I look at your code?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Activation only via posts edit form?’ is closed to new replies.