Home Forums Plugin Support WP User Frontend Pro Code to execute in "save_post action" not work

This topic is: resolved

Tagged: 

This topic contains 4 replies, has 3 voices, and was last updated by  Salih 4 years, 10 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #7988

    ggsalas
    Participant
    Post count: 108

    Hi I have found this code to upload and set as feature the image of the links.

    This code works when I add a post with WPbackend, but not work with WPUF

    I think is the same problem that I have in this thread. I think the problem i “save_post” action, I tried with this code but not work

    Also I tried modified this:

    add_action('save_post', 'wds_video_sideload_post_thumb');
    

    with this:

    add_action('wpuf_add_post_after_insert', 'wds_video_sideload_post_thumb');
    

    but not work

    Thanks and greetings

    #8004

    Tareq Hasan
    Keymaster
    Post count: 2831

    You understand what you are doing right?

    In that code snippet, they are using the global $post which will not work in the action hook in WPUF. Instead, the WPUF action hook gets an $post_id as a parameter. So replacing $post->ID with $post_id should fix it.

    #8022

    ggsalas
    Participant
    Post count: 108

    Thanks @Tareaq, now works well. I share the code in this pastebin: http://pastebin.com/2fsiXNiw

    Greetings

    #23469

    Salih
    Member
    Post count: 8

    Hi guys, I have the same issue with video thumbnail plugin. I just wanted to know where I need to insert this code or which code to replace. I have never used action hooks so I need a basic understanding (if this is actually what we are using here).

    There is also this other thread http://wedevs.com/support/topic/running-action-hook-on-frontend-post/ and I just wanted to know which one I need to apply and how.

    Thanks guys!

    #23768

    Salih
    Member
    Post count: 8

    Bump

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘Code to execute in "save_post action" not work’ is closed to new replies.