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

learn more… | top users | synonyms (5)

0
votes
2answers
200 views

add_filter doesn't work

I'm developing a plugin to replace a character for some user agents in titles, posts and comments but the filter doesn't work. Here is the plugin: <?php /* Plugin Name: WP-HalfSpace Description: ...
0
votes
1answer
732 views

Filter the_content to add something before each <h1> element?

I'm looking for a clean way of filtering the_content to add a piece of code before each H1 tag present in it. In fact, I have a long privacy policy text and I want to add a back to the top link before ...
0
votes
3answers
76 views

Finding actual functions added to hooks and filters

I'm trying to figure out how to find the actual function that's assigned to hooks and filters. I've been looking at other questions asked here and found a couple plugins that are helpful for findings ...
-1
votes
1answer
72 views

filter just a portion of plugin function

I'm trying to edit just a few pieces of bbpress' breadcrumb default settings, but the filters I've tried end up replacing the whole function. How do you replace only bits? Here is the filter as it ...
1
vote
2answers
1k views

Adding schema itemprop image to the_post_thumbnail with filters

I have tried to apply filters to the_post_thumbnail() function using apply_filters( 'post_thumbnail_html', $html, $post_id, $post_thumbnail_id, $size, $attr ); Here's the code I have come up with ...
5
votes
1answer
162 views

Add filter to blogroll widget

I'm trying to add <i class="icon-ok"></i> before the content inside the <li> of the blogroll widget. I'm assuming that's done through the link_title filter, but I can't find a ...
0
votes
1answer
333 views

Prevent menu from loading in a page template [duplicate]

Possible Duplicate: Remove navigation from header in custom page template Is there some way to remove wp_nav_menu in a page template? I can't find anything related to page templates other ...
1
vote
3answers
73 views

Where can you find the available filter tags?

In my attempt to alter navigations current-menu-item class, I found a possible solution http://stackoverflow.com/a/7941864/520265 , add_filter('nav_menu_css_class', 'my_css_attributes_filter', 100, ...
11
votes
2answers
1k views

How to make a image-size selected by default in Media upload - WP v3.5

Bare with me. I want to have a custom image size selected by default in the Media upload popup page. In Wordpress v3.4.2 and prior, this elegant code worked fine: function ...
1
vote
0answers
91 views

How to add a filter based on custom field to admin user list [duplicate]

I have added a column to the user list using two wordpress hooks: manage_users_columns and manage_users_custom_column. That's working fine. Now I would like to filter the user list based on a custom ...
6
votes
1answer
2k views

Set media upload attachment link to none and hide it in WP v3.5

In the Media upload popup page, how do I set the attachment link to none and hide it in Wordpress version 3.5? The following filter worked fine in earlier versions of WP: function ...
7
votes
2answers
2k views

Remove “Insert from URL” link in Media upload - WP 3.5

How do I remove the Insert from URL link in the new Wordpress 3.5 Add Media popup page? In earlier versions of Wordpress, this worked fine: // removes URL tab in image upload for post function ...
0
votes
1answer
3k views

add_filter on “the_excerpt” only works when post does not have excerpt

class my_menu extends WP_Widget { function widget($args, $instance) { // Excerpt length filter $new_excerpt_length = create_function('$length', "return " . $excerpt_length . ";"); if ( ...
2
votes
2answers
5k views

Filter by custom Field for Custom post type Admin Listing

I have a custom post type "Article" which has a custom field "issue" that is the id number of a "issue" post type that i am selecting using a simple select box. I want to add a drop down of issues ...
0
votes
1answer
302 views

Clean/filter HTML inserted to post content by XML RPC

An external service that uses XML RPC to publish some posts on my site adds some unwanted CSS styles and HTML to the post content. I would like to clean it up using a HTML cleaner that I've built ...
0
votes
2answers
581 views

Create subpage - filter parent pages list

I have a website here with a lot of content and with the content where is necessary to create pages in hierarchy. But it is uncomfortable to go through the dropdown in the administration with a lot of ...
0
votes
2answers
2k views

Using dynamic conditions in 'posts_where' filter

I have the following code which gives be posts that are published in the last 100 days function smbd_cats_by_days ($where = '') { $where .= " AND post_date < '" . date('y-m-d', ...
1
vote
1answer
156 views

Can I hook into get_avatar to supply a hash instead of an email?

I'm writing a plugin to PPK encrypt non-public comment data as a second line of defence against crackers (one of my sites was recently compromised, so I have been rather spurred into action!). To ...
0
votes
1answer
102 views

Hightlight search-terms with functions does remove or disable other filters?

I found the following two functions in order to highlight the current search term on my search-results page. function search_excerpt_highlight() { $excerpt = get_the_excerpt(); $keys = ...
0
votes
1answer
111 views

How to get changed post title in my custom plug-in which fires when 'save_post' is called?

I created a custom WordPress plug-in that hooks onto 'save_post" using add_filter(). I need to do something with the post titles and whenever a user changes the title, my plug-in cannot get the new ...
0
votes
2answers
105 views

Filter 5 latest post from the loop

Recently I made a theme for my wordpress blog. Now I wanna filter(remove) my 5 latest post from the main page(index.php) and show them into slider. Now my 5 latest posts are showing in the first page ...
3
votes
3answers
11k views

Woocommerce Product Category Widget - hide categories that have no products in stock [closed]

I'm using WooCommerce on my Wordpress site, and have a widget in the sidebar showing all product categories. It's setup to hide empty categories, and that works well. However, it still shows ...
1
vote
2answers
136 views

How can I insert some extra validation into the theme options' validation function using add_filter?

I'm using the theme options from the underscores (_s) WP theme as a base for my own theme options. If I wanted to insert the validation from the bottom function into the top function's $output array, ...
1
vote
1answer
830 views

posts_groupby problem

On my search page I want to group the posts by post type. To do this I've got the following: add_filter('posts_groupby', 'group_by_post_type' ); function group_by_post_type( $groupby ) { global ...
1
vote
1answer
368 views

display only the wp_nav_menu, which has the current-menu-item

i have a problem displaying only the menu with wp_nav_menu, in which the current-menu-item is in. Heres what i got: function register_menus() { register_nav_menus( array( 'sidebar-menu' ...
4
votes
2answers
4k views

add_filter and changing output captions of image gallery

I'd like to change only one output of native WP Gallery (in media.php) On Smashing Magazine (link) author advises to change whole gallery_shortcode function. But I wondered if is possible to change ...
0
votes
2answers
98 views

Filter and Search

I am working on my site which is a WordPress based site. It is a sweepstakes site well winprizesonline.com is the site which inspired me most. Now I want a dynamic search like that site on my site but ...
5
votes
1answer
2k views

Set JPEG compression for specific custom image sizes

I use various custom image sizes (by add_image_size) and I have set my JPEG compression to 30% with this filter: function jpeg_quality_callback($arg) { return (int)30; } add_filter('jpeg_quality', ...
1
vote
1answer
3k views

ajax for filtering posts by category in wordpress loops

I've been looking around for a way to filter my posts on http://www.waziproject.com/wazimagazine/ without reloading the page. So my question is if anyone can help me out to turn the following into a ...
1
vote
3answers
104 views

When to use actions and when to use filters

I'm trying to understand where to use filters and where to use actions. Suppose I have a query in a plugin, which later add on modules might modify to change the results of the query, thus modifying ...
0
votes
1answer
53 views

How to separate a specific page's comments from other comments

I am using WordPress comments on a page as a Contact form. Comments from my Contact form page are set to auto approve and only visible to the logged admin. Now in the dashboard I would like to ...
0
votes
2answers
472 views

How to use filter on comment submission/insert

I am working on a small project for my family to share info, recipes etc. And I added a "@" mention feature. Now that the mention feature works I need to notify the user they were mentioned. I ...
2
votes
1answer
513 views

How to Auto Approve Comments on a Specific Page?

I am using WordPress comments on a page as a Contact page and I am able to show those comments only to logged in admin. Now I would like to automatically have any comments placed on my Contact page ...
2
votes
2answers
954 views

Search results sorted by post types

I am working on a site with several post types - 4 to be exact - and I am trying to setup the search results page to have a filter/sort the results by post types. For example, when a person searches ...
1
vote
1answer
870 views

How can I remove the image attachment ALT field?

I've been using the technique described in this post to remove the caption and description fields in the uploads modal window, thus eliminating unused clutter for users. Since the title field is ...
2
votes
1answer
741 views

Taxonomy terms with edit/filter link in wp-admin, in the list of custom posts

I'm using get_the_term_list and manage_posts_custom_column to display the terms of a custom taxonomy in the list of custom posts, in the WordPress Admin. add_action( ...
5
votes
3answers
3k views

Filter any HTTP request URI?

I want to filter any HTTP request URI done through the HTTP API. Use cases: The WordPress update check goes to http://api.wordpress.org/core/version-check/1.6/, but ...
0
votes
1answer
600 views

add_filter to the_content after apply_filters

I have a shortcode that outputs null (""). What I'm trying to accomplish is to output a default message if the shortcode outputs null. I don't want to extend my shortcode because there may be ...
2
votes
2answers
3k views

Wordpress apply_filters() Arguments Missing

I'm customizing a Woocommerce Wordpress site. In the Woocommerce product class (class-wc-product.php) the get_price function applies a filter as follows: function get_price() { return ...
0
votes
1answer
1k views

Displaying custom taxonomy in the admin list of a custom post type

I'm trying to list the terms of a custom taxonomy ('genre') in the overview table in the admin area for a custom post type ('station'). To get this, I tried the following code in my theme's ...
1
vote
2answers
131 views

Failed to invoke other hook from the init hook

Related to this question (Use wp init hook to call other hooks?) but not the same. Sometimes, I found that the hook will failed to run when I place inside the init hook, e.g. Not Work: ...
1
vote
1answer
107 views

modify a function filter

I am using the latest version of wp-ecommerce (3.89) and a new filter has been introduced to enable role based access to certain dashboard features such as the sales page or upgrade capability. ...
2
votes
1answer
563 views

redirect pages with no content, instead of 404 error, using max_num_posts?

I have a site that has changed its pagination structure, resulting in a huge amount of 404 errors (more posts are being shown per page than previously, so there are lots of pages that were once ...
1
vote
1answer
652 views

Using Conditional Statement in functions.php

I've got this code below in my functions.php and I'd like to add two filters with conditional statement not to effect every query_posts. Something like this if(!is_admin() && ...
2
votes
1answer
821 views

Rewriting search and pagination base

After trying for weeks now how to find a working solution I got rid of most of my functions and trials and just left the pagination function underneath in my functions.phh file: /** * Pagination ...
0
votes
2answers
241 views

Change Default Content when Creating a Post based on Previous Category Choice

I'm working on a system that forces users (unfamiliar with wp) to choose a category before creating a new post, and then adds some appropriate html layout styling to help them. The following code ...
0
votes
1answer
457 views

Limit upload file type on one custom post type

Is there any way to limit the filetypes allowed for upload based on the current post type? For example, I have a custom post type called documents. I have a File upload custom field which calls the ...
11
votes
2answers
5k views

How to add sub-menu to a menu generated by wp_nav_menu by using plugin

I have a menu generated by wp_nav_menu which look like <ul class="nav-menu" id="menu-top-nav"> <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-43" ...
0
votes
1answer
349 views

Exclude custom function content from certain pages

I have added a small custom function to display a little author bio blurb at the bottom of each blog entry in my functions.php file inside the current theme that I am using. So far so good, it is ...
0
votes
1answer
167 views

What is the scope and persistence of add_filter() and remove_filter()?

I understand that using add_filter() or remove_filter() directly within a themes' functions.php would make the changes global across the theme unless you override them elsewhere. But believe this is a ...