I'm a wordpress user and I was wondering if Drupal has the ability to let coders modify the output, or return value of a function trough filters.

(in WP you can do this with add_action / add_filter)

2 Answers 2


Yes, there are a few methods.

One uses what Drupal considers filters. I a not sure what the best starting point for these is, but the API reference for hook_filter_info should be a decent read.

Another is via preprocess and process functions. Again, I am not sure what the best online starting point for these is, but take a look at the API reference and search for "process" and "preprocess".

The concept of Drupal 7 render trees along with field templates / template functions can also be thought of as a way to process content for display.

My copy is at work, but I think both filters and preprocess/process hooks are discussed in Drupal 7 Module Development. I can't remember if render trees and field templates are in that book or their theming book.


While Drupal coding is very powerful, It is also possible to do a great deal within Drupal without writing any code. The Views Module is basic a UI for the mySQL database providing general and contextual filtering capabilities by filling out the forms. If your interested in learning more about views, watch the video series "Taming the Beast" at nodeone.se.

  • Can you elaborate on how you use views to emulate what Wordpress filters and actions do?
    – mpdonadio
    Commented Nov 30, 2011 at 13:55
  • I don't know Wordpress. Basically, you can attach information to your content using fields. Views allows you to filter available information such content author, content and info in fields to filter the types of content available. Plus it can take information from the the immediate context of the page display through the URL address using wildcard filters to further filter what is displayed. Other modules such as Rules and Panels give you further control over what the site server does and how content is displayed
    – Ashlar
    Commented Nov 30, 2011 at 14:55
  • 1
    WP actions are pretty analogous to Drupal hooks. WP filters are for rewriting output for display (like turning shortcodes into HTML). They are essentially how WP plugins modify/extend the core behavior of WP. I just don't see how Views is a replacement for these.
    – mpdonadio
    Commented Nov 30, 2011 at 17:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.