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

learn more… | top users | synonyms (5)

7
votes
2answers
10k views

Trouble understanding apply_filters()

In apply_filters() apply_filters( $tag, $value, $var ... ); I'm having trouble wrapping my head around the $value and $var. I read the codex and it sounds like the $value can be modified, $var not, ...
0
votes
1answer
1k views

How to edit php code in WordPress Post file?

I have a wordpress page. In that wordpress page, user will have access to the following Window to Publish their Post in to the webpage. If the user enters an URL in any of the three filed I have ...
0
votes
1answer
262 views

add <div> to end of post in the loop with plugin

I'm looking to add a <div> with some more html content to the bottom of specific posts in the loop. The the_post action can be used to add the <div> to the beginning of the post in the ...
2
votes
0answers
565 views

Changing image URLs in media library

On a default wordpress install, the media library is located at: /wp-admin/upload.php. I am trying to update the image URL to point to my CDN, not my local server. This filter add_filter('...
1
vote
3answers
97 views

Disable widgets on specific posts

I run a horror related blog. Google is upset with me for displaying adsense in a sidebar widget for one specific post number (4603) that contains an article about an 18+ topic. How can I disable the ...
1
vote
1answer
239 views

add img class to native wordpress galleries

Trying to add an img class = "the image alt field" to the images in a native wordpress gallery so i can use jquery isotope to filter the gallery. I could use the image alt field or the description ...
1
vote
1answer
259 views

Two functions utilizing registration_errors filter

I wrote two plugins that utilize the registration_errors filter: add_filter( 'registration_errors', 'process_payment', 10, 3 ); add_filter( 'registration_errors', 'add_user_to_SF', 10, 3 ); When ...
1
vote
1answer
181 views

Using ob_get_content to get_search_form puts into infinite loop

I am trying to change the look of my searchform. It basically needs to have two text fields. I want this to be in form of a plugin, which anyone can activate. SO obviously I do not have any control ...
0
votes
1answer
371 views

How can I add a filter to a particular post format?

I have several post formats and I want to use add_filter selectively, applying the filter to some of the post formats but not all. When I do this in my functions.php file it affect all the post ...
0
votes
1answer
608 views

Empty string supplied as input when parsing content

I have this code: <?php function mb_find_my_image( $content ) { if( is_home() ) { /* if is home start */ $dom = new domDocument; $dom->loadHTML($content); $dom->...
1
vote
1answer
147 views

how to use force_filtered_html_on_import in add_filter?

This is my situation. I have two plugins, one plugin will read a remote XML file and downloads content then it calls a function on another plugin to do the actual importing of posts to the WordPress ...
0
votes
1answer
73 views

Filter everything from content except output of a shortcode

Is it possible to filter the output of either the content or excerpt so that I only get the the shortcode output and so that if a user enters more than the shortcode the rest of the content for that ...
2
votes
1answer
950 views

Gravity Forms field entries into wp_query loop [closed]

I have a simple function that filters the page content when form (ID 18) is submitted. It simply displays the entry of field (ID 13)... add_action("gform_after_submission_18", "set_post_content", 10, ...
3
votes
1answer
499 views

Integrate post tags in Post Edit page with qTranslate

Summary In the tags widget in the Post Edit page, I need to know a way to filter through: the tags suggestions the tag terms update when saving or updating the post At least that is what I think ...
1
vote
1answer
383 views

Remove class that has been added by parent theme

My parent theme generates the following class in body: style-cupcake. I don't want that. The best way to get rid of this is by adding my own functions in a functions.php file in my child theme, right? ...
2
votes
1answer
196 views

Trying to wrap <span> around first word of multiple word strings with a widget_title() filter, only works on two word strings and not more than two

I am trying to wrap a around the first word of multiple word widget titles. I have used the answer from here: http://stackoverflow.com/questions/10263792/revised-wordpress-function-to-put-a-span-...
0
votes
2answers
4k views

How to apply filter inside a single wp_query?

I've got a special query on my homepage that returns posts from a custom taxonomy. I'm trying to apply this filter for it. add_filter( 'post_limits', 'my_post_limits' ); function my_post_limits( $...
4
votes
1answer
758 views

Hide custom image sizes from media library

I want to hide a few custom image sizes from the media uploader: The following code (posted here) works only for the default image sizes: function remove_image_sizes($sizes) { unset($sizes['...
0
votes
1answer
648 views

Catch and display error on save_post action

I wrote this function that adds data to an external db every time a custom post called 'event' is created. How can I prevent the save from happening if this function returns an error? At the moment, ...
0
votes
2answers
823 views

Wordpress 3.5+ upload tool filter

i would like to use the brand new wp's upload tool in a personnal theme options page. I found a lot of tutorials like : wp media uploader in plugins ...and it works very fine. But i'd like to filter ...
0
votes
1answer
178 views

How to stop filter from running on the index.php page?

I'm trying to make a Wordpress function and currently I have this in my functions.php file: function find_my_image($content) { if(is_single()) { if (preg_match('#(<img.*?>)#', $...
1
vote
0answers
62 views

Alternative to the filter comment_reply_link

I'm making a plugin and need to add a link to every comment on the front-end. I've used the filter comment_reply_link but that filter doesn't work when we're on the lowest level of threaded comments (...
1
vote
2answers
592 views

global function to apply filter to custom field

I have an action hook which works perfectly for the_content. I would like to apply the same hook anytime a handful of custom_fields are requested. The custom fields are 1) myfieldone 2) myfieldart 3) ...
0
votes
1answer
581 views

preg_match() not working with post content

I'm new to Wordpress, and I wrote the following function: function find_my_image() { if(is_single()) { if (preg_match('#(<img.*?>)#', $content, $result)){ $content .= '<p>...
1
vote
1answer
443 views

Walker_Nav_Menu doesn't work in wp_page_menu_args filter

I need to hide certain nav items from the menu (based on the password protection functionality) and I'm having trouble getting my custom Walker to work. In fact, I can't even get the standard ...
0
votes
1answer
995 views

How to Add Additional Search Button?

I have added function to functions.php so authors can search only their published content. I would like to add additional "Search my posts" button to searchform.php so only logged in users would see - ...
1
vote
2answers
392 views

How to change the name of the “edit my profile” link in the WordPress admin backend

I am really confused at this point. I can not figure it out how to rename Edit My Profile link in the admin backend. How can that be done?
2
votes
1answer
370 views

Filter list by a unique meta value dilemma

I'm been racking my head at this for a while now, and I can't figure out how to fix the code. Here's the issue; I found a snippet of code online to filter my post results in edit.php based on ...
2
votes
0answers
165 views

How to add custom button to new media upload interface [duplicate]

I am developing a plugin and i want to add my own button to the wordpress media upload interface (WP version 3.5). Right next to the standard 'insert into page' button, i want my button to be there, ...
0
votes
1answer
73 views

Function Reference for custom link in Admin Menu Management Page

What is the function reference for the text within the URL field in the Admin Menu page? I have a PHP function that is utilizing the_content function reference to look for specific file paths and ...
0
votes
2answers
62 views

How we make the filter for fornt end user

I develope a filter for posts so that when any user come to my site they can filter the posts on the base of cities/state. So when i store the posts i just store the cities name as a post-meta tag in ...
0
votes
2answers
260 views

Paginate yearly archives for a custom post type

Here's the code I'm using to create yearly archives for a custom post type: function myquery_custom_post_rewrite( $rewrite_rules ) { $myqueryslug = 'customposttype'; $month_archive = array( $...
1
vote
0answers
70 views

Sorting a specific taxonomy by archive date using URL

OK, so I'm looking for a way to sort a specific taxonomy by archive date using the site URL. Say the custom taxonomy ("sort") value is "fruit" then then you would currently get all the posts marked ...
0
votes
1answer
1k views

filter posts by meta key with pagination

Trying to filter out specific posts that have certain meta_key from the main query... problem is it doesnt work with pagination which is my issue here. Anyone knows how to solve this? $paged = (end( ...
0
votes
1answer
507 views

Filter image and text from post format

I have a site that requires a lot of styling for post formats, I have never dealt with formats before but essentially what I want is : if post format is image... do this loop, if format is standard ...
1
vote
3answers
882 views

Change content before writing to database

I've searched around but I can't quite pin down the answer for this. I am attempting to use the content of a custom field as post_data and save it to the database as such when a post is created or ...
3
votes
3answers
6k views

Removing any and all inline styles from the_content()

For one of my current projects, I had to transfer blogposts from an old Wordpress site to my project. Things went smoothly until I've seen that all the posts were copy pasted from Word, leaving this ...
0
votes
1answer
212 views

Filter post before *editing*

I know there are a lot of hooks in WP for altering a posts content (and other fields) before the post is written to the DB upon saving; but what I am interested in doing is running my custom filter ...
0
votes
1answer
416 views

Display a list of users with avatar filterable with alphabets

I'm trying to create a page which should display a list of users with the role "Author" only and exclude all other default and custom roles. I also want them to be filterable by alphabets, so if I ...
3
votes
1answer
350 views

Allow Profile HTML for select users

I know there are a ton of post out there about how to allow html in profiles. Most of these warn about the security risk of doing so. My thinking is there has to be a way to only allow users to use ...
0
votes
1answer
75 views

How to add different CSS for galleries

I use jetpack carousel for all of my galleries , even for my featured image, my question is, how do I style my [gallery] outcome to use different CSS for the featured image so I can manipulate it a ...
1
vote
1answer
2k views

Add classname to the_category() function?

is it possible to use add_filter or something similar to add the slug of the category as classname to the the_category() function? Right now when using the_category() the output looks like this … &...
0
votes
1answer
442 views

How can I use wp_save_image_editor_file filter?

I would like to use wp_save_image_editor_file filter, but there is no documentation on the internet. Also, it seems that no matter how many arguments I pass to the handler, all are null.
0
votes
2answers
396 views

wordpress remove views from action links in a custom post

I have created a custom post type, but I want to remove the View link from actions, in the listing of the custom post. I have tried this snippet add_filter( 'post_row_actions',array(&$this, ...
0
votes
1answer
968 views

get_posts() and filters

I've added a custom filter function for the_posts filter in a plugin. add_filter('the_posts', 'posts_filter'); function posts_filter() { … } This works pretty well in the main loop, that means the ...
4
votes
3answers
4k views

Add class to menu items of one specific menu (nav_menu_css_class)

This code adds an extra class to all my menu items: add_filter('nav_menu_css_class' , 'special_nav_class' , 10 , 2); function special_nav_class($classes, $item){ $classes[] = 'btn'; return $...
1
vote
1answer
98 views

Creating a plugin to sanitize comment and the url field before display only

I want to create a plugin to sanitize comment and mainly the url field before display only (not before adding to database), to filter the url fields and only allow displaying this field only if it ...
2
votes
1answer
143 views

What is the purpose of $merged_filters?

Savvy WordPress user here, or at least trying to be. I have the hang of hooks and filters with the code in WP's plugin.php The only thing I cannot seem to understand is the $merged_filters global. ...
0
votes
1answer
329 views

wp_query and comment_parent - select only posts with top level comments

I have a custom post type of 'films', and I'm creating a number of search filters using wp_query. All are working fine, but I now need to add in an option of exclude results that dont have any top ...
0
votes
1answer
166 views

Filter Shortcodes when using get_page

I'm using the following line to show content from one page on another. This line outputs the content's raw text of a shortcode: <?php $id=3934; $post = get_page($id); $content = apply_filters('...