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

learn more… | top users | synonyms (5)

0
votes
1answer
247 views

How do I pass the value from a foreach loop to an add_filter function? [closed]

I'm trying to add multiple filters from inside a foreach loop. Unfortunately I can't get the code to reference the value properly. How do I pass the value from the loop to the function? The following ...
0
votes
2answers
241 views

Apply Filters Causing a 500 Internal Server Error

I have a custom post type and need to display it in a certain way. I would like other posts to display as normal. When I tried to use the following code to accomplish this, I get a 500 Internal Server ...
0
votes
1answer
1k views

Is it possible to override the default Gallery Settings form?

I'm trying to change the options that are presented for the gallery settings. I can't seem to find a hook or override that gets exactly what I want. I came close with the following, but it only seems ...
2
votes
2answers
1k views

How to use filter hook 'post_updated_messages' in coherence with action hook 'save_post'

I am trying to send out e-mail, SMS and IM notifications to group members of this WordPress website, whenever a WordPress page in their user group has been published/updated. I figured using the ...
0
votes
1answer
404 views

Buddypress Filter Multiple Activities [closed]

I'm trying to exclude activity updates (ones users actually post) from a custom "ticker" I'm running. With the below code, I am only displaying activities where friendships are created. How do I add ...
0
votes
2answers
74 views

Way of getting queried loop before the query with a filter hook?

Is there a way to get the results of a loop with a filter before the code for the loop is performed in the structure of your code? My markup is something like this: <body> <div> /* ...
0
votes
2answers
1k views

Insert a div before the wp_nav_menu

How do I go about inserting a custom div before the wp_nav_menu() adds the ul? The problem is that the script is inserting my 'div menu button' after the nav ul instead of before it. I am trying to ...
6
votes
1answer
867 views

Changing JPEG compression depending on image size

Short. I want ''large' images compressed by 90%, and 'medium' to be by 60%. Has many af you know, sometimes larger images suffer from high compression, but other small images don't. This function ...
0
votes
1answer
172 views

Create widget that filters posts on current page based on entered value

Can somebody point me in the right direction wouldnt have a clue how to start programming this. I want to filter post based on price (custom value) thru a widget. So lets say you click on a post ...
0
votes
2answers
3k views

Using a filter to modify Genesis wp_nav_menu

Genesis framework applies filters to the wp_nav_menu(). What I want to do is 2 things. 1 change the menu class via a filter 2 add a menu id via a filter Here is the function I am trying to add a ...
0
votes
1answer
758 views

show most viewed posts of last days by link?

I use this link to get most viewed posts: http://mydomain.com/?post_type=movies&meta_key=post_views_count&orderby=meta_value&order=ASC But that gives me ALL posts from this post type ...
0
votes
1answer
610 views

Unfiltered html in widget title not working

function update( $new_instance, $old_instance ) { if( current_user_can( 'unfiltered_html' ) ) { $new_instance['title'] = strip_tags( $new_instance['title'], ...
1
vote
2answers
3k views

wp_title() empty on a static front page

I'm trying to use wp_title() to create a heading for my pages, but I'm using a static front page and, while all of the other pages render the title properly, the front page won't. This is what I'm ...
-1
votes
2answers
421 views

apply_filters, EMBEDS and AJAX not a friends?

I encountered a problem... There is content that contains a YouTube link Lorem ipsum bla bla bla http://www.youtube.com/watch?v=nTDNLUzjkpg My plugin display this content with that code in the ...
0
votes
1answer
140 views

Simply Exclude - Category feed exclusion is excluding from category feed instead of just the main feed

I am using Simply Exclude to make sure that certain categories do not show up on the home page and in the sites main feed, http://example.com/feed. However, excluding the category from the main feed ...
2
votes
1answer
62 views

How do we check if the user is logging in or registering?

I am changing the text on the login page using this filter: function filter_register_text() { return "<p class='message register'>Registering for this site will give you access to the admin ...
3
votes
2answers
1k views

Using attachment_fields_to_edit filter inside plugin class

I'm writing a plugin using OOP. I realise that filters and action hooks need to be placed inside the constructor method in WordPress like so: add_action('wp_enqueue_scripts', array($this, ...
0
votes
1answer
100 views

get_query stops working after post filter

I'm currently trying to set up some filters for a custom post type within my admin. The custom post type is 'players' and I'm filtering them by another custom post type 'teams'. To create my ...
0
votes
1answer
227 views

Is there an action_filter hook to add content before the post title?

I am looking to add content before the post title but not included in the markup of the title itself so adding to the_title doesn't seem to be the right hook for this. Thanks
3
votes
0answers
99 views

Disable Create New tags for posts [duplicate]

Possible Duplicate: Can I turn off write-in tags/taxonomies? I am trying to disable creation of new tags for posts. If a tag is in exisiting list of tags, it will be added with post ...
39
votes
3answers
3k views

How to remove a filter that is an anonymous object?

In my functions.php file I would like to remove the below filter, but I'm not sure how to do it since it's in a class. What should remove_filter() look like? add_filter('comments_array',array( ...
1
vote
2answers
2k views

How to only hook on Single.php after content?

I am currently hooking on the_content() but that goes through the Wordpress loop too. How can I only hook on the Single.php page? Also, is there a way to only look on the first X posts in the ...
2
votes
2answers
3k views

How to filter get_avatar?

I want to use local avatar system for my wp website , I want to filter the get_avatar() function so it will return the avatar from my server instead of the default gavatar . I have the following code ...
4
votes
1answer
979 views

<form> inside a metabox

I'm trying to write a plugin that allows a user to upload a video to Vimeo through the Vimeo upload API. In order to avoid trying to upload a video to a potentially shared hosting account and then ...
1
vote
1answer
483 views

Exclude One Category and its Subcategories using WP_LIST_FILTER

I need to exclude a category and its subcategories in posts. This is the code I'm working on and it works: <?php $categories = wp_get_post_terms($post->ID, 'category'); ...
5
votes
1answer
400 views

Limit Media Library to Given Folder

I have made a plugin that uses the Media Library to allow users to upload files to a specific directory - using the upload_dir filter. I would like to know if there is a way (i.e. a filter) I can use ...
1
vote
2answers
115 views

Too many actions/filters!

New to wordpress here. The concept of actions/filters in and of itself is not too difficult to grasp. What I am overwhelmed by is the HUGE amount of actions and filters available. When I am looking at ...
2
votes
4answers
460 views

Filter link to existing content suggestion

How can i filter the link given in "link to existing content". Eg: As in the above image. I just want WSP BANNER TO BE SHOWN. where WSP BANNER & CALENDAR are custom POST types Any help will ...
0
votes
1answer
183 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
280 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
355 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
910 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
86 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
146 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
666 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
985 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
121 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
872 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
863 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
878 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
807 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
206 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 ...