A type of hook that provides a way for content to be overridden programatically

learn more… | top users | synonyms (5)

0
votes
1answer
180 views

add_filter for where statment issue

I am trying to get start and end dates for posts filtered, and I found the documentation for the 'posts_where' filter, I am just testing it so far, but when ever I add the filter, it seems to pull in ...
0
votes
1answer
274 views

Add filter on certain thumbnail sizes only

How to run this filter only on some specific registered thumbnail sizes '$size' ? like 'large' , 'medium' .... add_filter( 'wp_get_attachment_image_attributes', ...
2
votes
2answers
351 views

Load different template file when condition met?

If I visit a page on my WordPress site, WP goes and determines what template file it should use based on the template hierarchy. If I'm doing some logic checking in the hook init and say my ...
4
votes
1answer
1k views

Insert new element to array with add_filter

add_filter('example_filter', function(){ return array( 'tax1' ); } ); add_filter('example_filter', function(){ return array( 'tax2' ); } ); add_filter('example_filter', function(){ return array( ...
0
votes
1answer
887 views

Should I use add_filter for functions in function.php of the theme?

I have written few functions in the function.php file of the theme. Should I use add_filter function for those functions?
0
votes
1answer
84 views

add_filter with specific thumb names

How would I run add_filter only on some specific registered thumbnail sizes '$size' ? like 'large' , 'medium', etc?
0
votes
1answer
145 views

changing parent_id on post

I'm trying to change a post's parent via the wp_insert_post_data filter but I'm not having any luck. In the example below, I'm replacing any "parent" references with the id I want to set. function ...
2
votes
2answers
1k views

How to order posts tag by tag?

I want to order my posts by tags with only one WP_Query() In my WP_Query I would like to display 2 posts with tags portrait 2 posts with tags paysage 2 posts with tags portrait 2 posts with tags ...
2
votes
1answer
646 views

What hooks/filters are there to alter selected terms on post save?

Very simple, where would I hook/filter to alter the users selection of terms when they save a post (Update or Add)? I need to hook in all instances; such as when saving a post via AJAX, saving when ...
0
votes
1answer
966 views

post->post_content filter

I'm trying to determine if the REGEX I'm using is incorrect -- or if I'm missing something basic here. The following: add_filter('the_content','wpdu_image_replace'); function ...
2
votes
2answers
110 views

I have a table I created, how do I make a form for a user to filter the data?

I have created a table, I now need to filter the data from that table when someone selects options from a form. Whats a good way to do that?
0
votes
1answer
86 views

How to remove this filter?

I can't remove a filter that added by media-tags plugin. it was originally added this way: add_filter( 'attachment_fields_to_edit', 'mediatags_show_fields_to_edit', 11, 2 ); I tried to remove it ...
4
votes
1answer
1k views

How to change “Draft” string for status of custom post type to “Unavailable”?

ANSWER MOD: just an important mod to the chosen answer: // check if you actually have drafts; also avoids extra '|' separator if (isset($views['draft'])) { // 'Drafts' should be added (and come ...
0
votes
1answer
118 views

Should I remove_filter in order to replace a filter?

If a plugin modified one of wp's filters by "add_filter", and I want to discard the modification and modify the wp's filter by my own codes. Should I remove the plugin's filter before I add my own ...
0
votes
1answer
127 views

Change page title from page using php via php executed from page/post itself

I am running a plugin from a WP page to execute PHP and it works great. I'd like to edit the page title and description based on POST data. I am already using POST data in the PHP code to alter the ...
0
votes
2answers
1k views

Add filter to get_posts

So I am attempting to filter out certain posts in the get_posts call. Essentially, I want to be able to specify a certain block of posts, and only get the posts that correspond with the block. Right ...
1
vote
1answer
846 views

add data-attribute to all images inside the_content()

I wonder if it's possible to add a filter to all images inside the_content() to create the following image pattern for all images … <img class="digest" src="smallest-file.jpg" ...
0
votes
1answer
42 views

Something is filtering my shortcodes… Can't figure out what

Something seems to be filtering out my shortcodes. I'm not sure what or where, and I've looked just about everywhere trying to find it. Is there anything I can do to find out what filters are being ...
0
votes
2answers
836 views

Filter for post_thumbnail: link to small src and add data-attribute [duplicate]

I wonder how I can link manually to the smallest filesize for the_post_thumbnail() within its filter function … add_filter( 'post_thumbnail_html', 'post_thumbnail_html', 10, 3 ); function ...
0
votes
1answer
853 views

Trimming a custom field to a length

I have a custom field added through the Advanced Custom Fields Plugin. I am trying to trim the content of the field down to a set number of words. I have tried to use the excerpt filter and setting ...
1
vote
2answers
802 views

category filter doesn't work in WPML

I translate the categories to another language, but in the main page, the two language categories are all displayed. How can I filter another language? My WPML version is 2.4.1. I found all the ...
0
votes
1answer
204 views

post_class() breaks out of formatting. . . extra markup also generated

Hoping Im just running into something easy Here's the scenario, I've created a function called tr_get_post_image_tplt that spits out the post thumbnail (or custom size) for the post being called. Im ...
1
vote
1answer
626 views

Remove bulk actions based on user role or capabilities

How can I remove the "bulk actions" based on user roles or capabilities. Actually I have this code to do the job, but now I need to exclude the site admin, I need to let the administrator to access ...
1
vote
1answer
115 views

Valid filenames for add_action's first parameter

Some examples in WordPress' docs pass a filename to add_action rather than an action name. For example, add_action( 'load-post.php', 'callback' ); add_action( 'load-post-new.php', 'callback' ); ...
2
votes
1answer
1k views

Custom search filter causes menu and query_posts problems

I'm using a custom search filter (using my custom query var type), like so: function fteh_pre_get_posts( $query ){ if( isset( $query->query_vars['type'] ) ) $types = explode( ',', ...
3
votes
2answers
562 views

What characters are allowed as a shortcode tag and how should they be sanitized?

I am working on a plugin where the user can define shortcode tags himself. What would you suggest to allow in there? My thought is only allow ascii characters. So how do I sanitize? strip_tags and ...
1
vote
1answer
96 views

Is there a way to remove or hide individual pages on the Edit Pages screen?

I want to create a handful of pages that I do not want the client to have access to through the edit pages admin screen. I do want the pages to have all the normal functionality of pages in other ...
2
votes
1answer
617 views

Add $more_link_text parameter to the_excerpt()

this filter is on the Wordpress Codex …  add_filter('excerpt_more', 'new_excerpt_more'); function new_excerpt_more($more) { global $post; return '<a class="moretag" href="'. ...
0
votes
1answer
48 views

Add Filter to Ignore a Post/Page or a Number of Post/Pages

Hoping someone can assist but as part of normal WordPress theme searching, how can I add a filter as part of the search to not include certain posts/pages as part of my LOOP? For example, I want the ...
1
vote
1answer
851 views

Filter all html output

I would like to make sure no email address is published in plain. So i developed a plugin that replace all email addresses by a spambot-safe alternative. But some users put their email address in ...
4
votes
1answer
185 views

Store source permalink on XMLRPC calls

In a theme I'm developing, I need to link to the source post when the post has been stored using XMLRPC. That implies that every time Wordpress asks for a permalink (using get_permalink()) the theme ...
0
votes
2answers
2k views

Query posts using custom taxonomy and selected terms

I'm not able to use array for the terms in the following query, only a single term: $args=array( 'facts' => 'information', //taxonomy:facts and term:information 'post_type' => ...
2
votes
1answer
910 views

How to remove or replace the log-in link for comment replies?

I need to edit the function get_comment_reply_link() in wp-includes/comments-template.php. All I really wanna do is take out the "log in to reply" text is puts in every comment for logged out users ...
0
votes
2answers
160 views

Currently using a query_posts() in my theme - want to use a request filter in stead

I am currently using this code in my theme right before showing the content of the custom post type my_post_type: $title = $post->post_title; query_posts( array ( 'post_type' => 'page', ...
1
vote
2answers
371 views

Filtering out the #more anchor link that gets produced by <!--more-->

Back in my naive days of theming, I had to make it so the link inserted by <!--more--> wouldn't dump the viewer at the anchor it produces. I made a dinky plugin that consisted of: function ...
4
votes
3answers
1k views

What filters are applied to the_content function?

How does WordPress convert raw data from the database to a readable format in the_content function? I've noticed that it applies the_content filter, but what does the_content filter do?
1
vote
1answer
3k views

Add Class to Specific Paragraph of the_content()

Let's say I want to give the first paragraph bold text by adding a body class to the first paragraph. Is there a way to filter the output of the_content(); or any other paragraph? First paragraph? ...
0
votes
1answer
149 views

Adding a filter to wp_edit_posts_query() to prevent hierarchical display of pages

So I have a Wordpress 3.3.2 installation with around 8k pages in it now. I seemed to have gotten past a threshold that causes edit.php and the page listing in the admin to take about 20 minutes to ...
0
votes
1answer
93 views

Override typo in multiple parent theme files?

I'm using the lovely Imbalance theme from WPShower. I am able to make almost all the modifications I need through files and filters in the child theme I created. However, there is a typo that appears ...
2
votes
1answer
5k views

Setting title using wp_title filter

I want to do something very simple but I'm stuck finding where in WordPress I need to perform this. When someone on my WordPress site visits a blog post page I want the title in the blog post to ...
3
votes
1answer
1k views

How can I detect if a user changes their password?

I would like to track when a user changes their password. Is there a way to detect when a password has been changed?
1
vote
2answers
2k views

How to get Post ID with the Add Filter Function

I'm writing a plugin and am trying to figure out how to add data to the end of a post based on some Custom Meta Information. So i've done this so far: add_filter('the_content', 'AppendMeta'); And ...
0
votes
1answer
381 views

Excluding posts by meta, and also keeping posts without the meta

edit: Think I managed to figure it out, check the answer right under here, or click the following link: http://wordpress.stackexchange.com/a/51175/15809 I've been trying to find a way to exclude ...
0
votes
1answer
2k views

Add filter to wp_dropdown_pages() or wp_dropdown_categories() - no select container?

I'm working with wp_dropdown_pages() and wp_dropdown_categories() and both are always outputting a <select>-box with its <option>s as items. Is it possible to add a filter/hook to this ...
0
votes
2answers
690 views

Maintaining a separate posts page for certain categories and don't show those on home page

I have a personal blog where I write general posts. I decided I'd like to seldom post about some other topic (let's say it's cats), that interests a very different audience then my current one. So I ...
2
votes
1answer
245 views

Manipulate Output of wp_list_something: select menu instead of li's

I'm working on a responsive webdesign where my navigation should swap into a select-menu when resizing the window in smaller sizes. Is it somehow possible to add another param to functions like ...
1
vote
2answers
3k views

How to wrap oEmbed-embedded video in DIV tags inside the_content?

I am making a Wordpress Theme for a website with video tutorials. I would like to put the video that is embedded in the content (with oEmbed) in a apart div. An example The full content (output from ...
2
votes
2answers
270 views

Clean-up script tags

I want to clean up <script> tags generated by WordPress to produce more semantic output for HTML5. You can already do this for <style> tags using this code attached to the ...
1
vote
1answer
436 views

What is the optimal way to filter out subpages from admin?

I guess it's always possible to hide them with js, but is there a code snippet out there for query level child page filter? I only want top level pages to remain. EDIT: my coder came up with it, stay ...
5
votes
2answers
1k views

Unregister Nav Menu from Child-Theme

I like to use the Starkers Theme and build child-theme. So, I`d like to remove the this primary menu Starkers (functions.php) function starkers_setup() { // This theme uses wp_nav_menu() in one ...