Support » Plugins » add_filter and custom fields

  • 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

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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.

    That works beautifully.

    Many thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘add_filter and custom fields’ is closed to new replies.