Opened 20 years ago
Closed 20 years ago
#2424 closed enhancement (wontfix)
Filter hook for page content
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 2.0.1 |
| Component: | Template | Keywords: | hook filter |
| Focuses: | Cc: |
Description
Is it possible to add a filter hook which will only apply to page content, and not post content? the_content hook applies to both pages and posts.
Note: See
TracTickets for help on using
tickets.
You can do this by using the is_page() function to tell what you're showing currently.
function my_page_filter($content) { if ( !is_page() ) return $content; // only want this to work on pages // do your filter stuff here return $content; } add_filter('the_content', 'my_page_filter');