WordPress.org

Ready to get started?Download WordPress

Forums

run function on new post (2 posts)

  1. criuz
    Member
    Posted 3 years ago #

    Hi,

    I am quite new to tweaking/hacking wordpress to suite my needs, so please be patient with me.

    Here's the scenarion: I installed ffmpeg on the box where I run wordpress from. In my wordpress installation I created a custom post type called videos. Now I'd like to run ffmpeg and create a thumbnail everytime I create a new "videopost". Since ffmpeg-php doesn't work as expected I'd run ffmpeg via exec();.

    Now my main question is: How could I run the exec(ffmpeg); function everytime a new post in the custom post type is created?

    Kind regards,
    Chris

  2. s_ha_dum
    Member
    Posted 3 years ago #

    Use one or more of the post actions hooks, probably save_post but play with it to see what works best. You'd do this:

    function my_ffmpeg_func($ID) {
    // some code
    }
    add_action('save_post','my_ffmpeg_func');

Topic Closed

This topic has been closed to new replies.

About this Topic