views:

667

answers:

1

Hello,

I'm wondering if it's possible to add filters and actions on Custom Fields in a post?

I have a plugin that extracts all <a> tags and converts them into trackable objects. This works great for the content and excerpt but I can't figure out how to filter the Custom Fields.

I've tried calling the below:

add_filter('the_meta', 'function_name', $priority)

which I read should work but it doesn't seem to do anything.

Any help would be appreciated.

+1  A: 

The code you've shown adds a filter to a hook that doesn't exist within the default installation of wordpress. Are you trying to get your function to execute within the the_meta function in wp-includes/post-template.php? If so, then you need to attach your filter to the the_meta_key hook. Your code should then read:

add_filter('the_meta_key', 'function_name', $priority)

If this is not the function you want, then you'll have to add an apply_filters function call to run your custom filter.

Todd Rowan