Forums

add_filter and custom fields (3 posts)

  1. marcusjwilson
    Member
    Posted 1 year ago #

    Hi folks

    I have a plugin on my WP3.1.2 install that adds a filter to the main post content in order to expand a shortcode and show VodPod video content:

    add_filter('the_content', 'expand_vodpod_shortcode');

    However, I'd also like to apply the same filter to a custom textarea field in my posts entitled rh-column.

    Would the same logic apply? i.e...

    add_filter('rh-column', 'expand_vodpod_shortcode');

    ...or is more required?

    Many thanks

  2. apljdi
    Member
    Posted 1 year ago #

    You can create your own filters but I'm not sure you need to get that complicated. I'd probably do this:

    $rh_column_content = "placeholder for your rh-column content, however you have it set up";
    $rh_column_content = apply_filters('the_content',$rh_column_content);

    The catch is that the 'the_content' filters might do more than you want them to. If so, I'd be tempted to try to call that 'expand_vodpod_shortcode' function directly.

  3. marcusjwilson
    Member
    Posted 1 year ago #

    That works beautifully.

    Many thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic