WordPress.org

Support

Support » How-To and Troubleshooting » run function on new post

run function on new post

  • 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

Viewing 1 replies (of 1 total)
  • 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');
Viewing 1 replies (of 1 total)
  • The topic ‘run function on new post’ is closed to new replies.