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

learn more… | top users | synonyms (5)

0
votes
1answer
178 views

How properly write function to filter content in a template for plugin “multiple content blocks”

In a website I'm building (using my own designed theme, for a business site that doesn't have a blog, IOW, using WP for it's CMS), I have 5 templates: the homepage, the 404 page, the default ...
0
votes
1answer
126 views

Looking for a filter to modify the months

Hi making a simple plugin that replaces the wrong russian month with the right ones. But I can't find any filters that works. I have tried these filters without success: ...
1
vote
1answer
79 views

Publish/Update post is changing image links from file url to post url

I've written a filter to wrap images included in posts with figure tags and their captions with figcaption tags. I turned off the visual editor so that it doesn't strip out all the html from the ...
0
votes
1answer
498 views

Filter dashboard custom post listing by user

Did some research, but I was unable to implement it after all. I have a custom post type accessible only by a new role. I want to filter the post type listing so that each user should see only his ...
0
votes
1answer
719 views

How to prepend text to the_content, but after img/shortcode

I was trying to add some text to the beginning of every post (the text comes from post_meta, but for this example let's assume it's static text). Here's what I tried: add_filter('the_content', ...
1
vote
2answers
158 views

how to determine how many and what kind of arguments are passed to hooks

I am not able to understand a very logic behind add_action / add_filter Consider following example: function SearchFilter($query) { if ($query->is_search) { $query->set('post_type', ...
14
votes
1answer
12k views

How to add defer=“defer” tag in plugin javascripts?

I couldn't add defer tag in plugin javascripts. Google developer pagespeed test suggests me to add defer tag in contact form 7 javascripts. This is how contact form 7 includes javascript in header. ...
3
votes
1answer
4k views

How does filter the_posts work?

I don't want to display post with empty body / post_content on my home page. So I added below code to my function.php. It detects post with empty body but it still display them. I expected that if I ...
7
votes
3answers
10k views

apply_filters() and the_excerpt are giving unexpected results

I feel like I must be missing something pretty obvious, here, but I can't seem to get WordPress to cooperate. I'm generating Facebook OG tags with a function. Everything works fine, except for the ...
2
votes
2answers
250 views

remove_filter( 'comment_author', 'floated_admin_avatar' ); doesn’t work

In a small plugin I’ve written to add an IP address column to the comments list I want to remove the avatars. In line 156 I tried to use remove_filter: remove_filter( 'comment_author', ...
0
votes
1answer
471 views

category filter doesn't work

I am assuming because I don't have a category template it is defaulting to the archive template, would that affect the outcome. it seems to output all the posts that have categories: ...
0
votes
1answer
156 views

Taxonomy search filters

I have developed an educational courses database of several countries using several taxonomies. Country, institute, study level and some other are taxonomies. If user click on some country, all ...
3
votes
2answers
694 views

How to add filter to __() and _e()?

I would wish to add a filter to _e() and __() functions. The filter is FilterTextOfEmail(). This will basically detect any emails and add anti-spam method to it. I assume, the function for filtering ...
0
votes
1answer
379 views

Modify posts listing at back end

I want to modify posts listing at back end? Say, for a particular user, with role author, O want to list only few posts at posts listing. How can I do this?
-1
votes
1answer
74 views

Removing title from page

Hello attempting to remove the title from static front page using the following code is (not working) in my functions.php function remove_page_title() { if (is_front_page() ) { add_filter( ...
1
vote
2answers
1k views

Removing strip_tags not working on nav_menu_description

So I'm adding descriptions to my site's main menus. Checked the box, added the text. Dropped in a custom walker in functions.php. Dropped in a wp_nav_menu call in header.php to call the custom walker. ...
2
votes
1answer
236 views

Some questions regarding filter

1) Take a look at this example add_filter( "xxx_xxxxx", "blah_blah" ); function blah_blah(){ echo "filter added"; } xxx_xxxxx can be anything like my_filter or it should be one of the ...
0
votes
1answer
333 views

How to add a filter to the get_body_class function?

I see it is possible to use add_filter with the body_class function, but I'm needing to add one to the get_body_class function. How can I add a filter to a function that is not included in the list ...
3
votes
3answers
2k views

How to remove Filters from post admin page?

On a custom post type, I want to remove the filters that show up on /edit.php (where all of the posts are listed out). I have a custom taxonomy that shows up as a filter that I WANT to keep, but I ...
0
votes
1answer
1k views

Help With issue on pre_get_posts filter in taxonomy

I create a function to filter the taxonomy query with this code add_action('pre_get_posts', 'custom_taxonomy_query'); $option_taxposts_per_page = get_option('tax_posts_per_page'); function ...
22
votes
3answers
8k views

remove_action or remove_filter with external classes?

In a situation where a plugin has encapsulated its methods within a class and then registered a filter or action against one of those methods, how do you remove the action or the filter if you no ...
1
vote
2answers
3k views

What is the filter hook for custom fields content?

The following code hides "the_content" output add_filter( "the_content", "cp_module_pcontent_post_content" ); function cp_module_pcontent_post_content($content){ global $post; ...
2
votes
3answers
8k views

How can I edit post data before it is saved?

I have a plugin and I would like to be able to run the post content through some filters before it is saved to the database. From looking at the plugin api, I see that two hooks that look like they ...
2
votes
1answer
56 views

How can I show more than 15 themes at a time in the admin menu?

I have a lot of themes in my test wordpress site. I get a little frustrated that I can't show more than 15 at a time. In pages and posts you can click "screen options" to choose the number, but it ...
0
votes
1answer
610 views

Filter search posts by post meta?

I'm working with a custom post type with custom taxonomy and custom fields and trying to filter the displayed results (on admin post listing page) by the custom field values... I've been trying to ...
0
votes
2answers
981 views

Add mime types with plugin

I've tried a few plugins to add mime types including the PJW Mime Config plugin. And adding this to a themes functions.php file would work fine, too, for a non-WPMS site. But I need these to be ...
1
vote
2answers
259 views

Excluding specific widgets from default sidebar class

I have two sidebars using the register_sidebars function that display each widget as a list item with a class of .box: <?php if(function_exists('register_sidebars')){ register_sidebars(2, array( ...
1
vote
1answer
145 views

How to find the origin of a file upload from within wp_handle_upload?

I have a plugin that hooks into "wp_handle_upload" filter. Within that scope I'd like to be able to identify where the upload came from, meaning I want to treat it differently if it was uploaded from ...
0
votes
2answers
235 views

How to make modifications only to certain elements of an HTML string on the server-side?

Is there a similar way to select / perform DOM manipulation on the server-side (PHP) like the way jQuery works? For example, if I wanted to modify content of each <pre ...
1
vote
1answer
1k views

How to display posts under a specific subcategory of a given category

after a long search online I have decided to post my problem here in the hope of getting a solution to this issue. Well, I have a custom post with various categories (novels, books, magazines etc..) ...
1
vote
1answer
376 views

How do I alter the comment form 'allowed tags' text in a plugin?

I'm using the PHP Markdown plugin, and I'd like to modify it so that it adds some text to the bottom of the comment form indicating that Markdown is supported in comments. I've been modifying my ...
0
votes
1answer
149 views

Modifying search results based on post_type

Is there an easy way to highlight search results based on post_type? I am using Job Manager plugin and when a site search is performed, I want to simply add a note e.g. (Job) next to the Job Results. ...
0
votes
1answer
116 views

Are href attributes of a elements filtered on output to add the current path?

I have some code that basically looks like this (it's more complicated, but even this example shows what I'm running into): echo '<a href="#">TEST</a>'; However, what gets sent to the ...
0
votes
1answer
76 views

Any adverse effects of adding apply_filters to a function?

I'm going back through my older WordPress theme and making the functions filterable and also adding the function_exists checks. Is there anything I'm not thinking about that this may cause problems ...
1
vote
3answers
2k views

Wordpress 3.2(Multisite) - How to add custom user meta fields to signup form?

I want to add custom user meta fields to registration page. I use WP multisite so I have to modify wp-signup.php. Adding some field is easy for me(I am programmer :P). But I have a problem with this ...
0
votes
1answer
211 views

get_image_tag filter not working

I'm trying to get the custom field data off an attachment and display it following the image tag in a page/post using the get_image_tag filter. I'm using the same function to get the same data and ...
0
votes
1answer
646 views

Anonymous function is executed twice in wp_head while added from the_posts filter?

I know this sounds complicated, so bear with me. I'm trying to add certain custom css styles based on the shortcodes(if any) in the current post/page. function load_shortcode_styles($posts){ ...
1
vote
1answer
897 views

Changing bloginfo description from a plugin

How can I change the site's bloginfo description in runtime from a plugin? I tried these, but none of them work: add_filter('description', 'ab_arq_generate'); add_filter('blogdescription', ...
7
votes
1answer
9k views

Removing Image and Caption Dimension Attributes

This question is an offshoot from the this discussion on removing dimension attributes from images. The solution code provided on that thread works very well except that it has the unfortunate side ...
3
votes
4answers
848 views

Run shortcode before filters

My users post snippets code in comments. I created a shortcode for this : function post_codigo($atts,$content=""){ return '<code>'.$content.'</code>'; } ...
0
votes
2answers
234 views

Joining tables not working in the post editor page

I am developing a plug-in which stores data in a custom table and is joined onto the wp_posts by the post's the id. I then use the posts_join and post_fields filters to join my table and be able ...
1
vote
1answer
954 views

Is it possible to Hook/Filters Attachment Creation?

Is it possible to hook or filter the attachment creation process? More specifically is it possible to hook into the attachment creation so that I may parse the attachment’s filename, populate the ...
1
vote
1answer
957 views

Wordpress Search Filter Only for Page with Child of Child of Child of Child of Child

after browsing question from this site I found the workaround for this: function SearchFilter($query) { if ($query->is_search) { global $post; $query->set( 'post_parent', 21 ...
1
vote
1answer
2k views

How I got jQuery Quicksand working with WordPress?

I have been tryin to make this plugin work but I failed badly. I have the code like below: The portfolio-terms is filtering buttons: <div id="portfolio-terms"> ...
0
votes
1answer
250 views

Can I change the “Home” text in the menu?

I’m pretty sure this can be done with a filter or some kind of find and replace, but I’m not sure how. I have a page called “Home” like so: When the link is displayed in my template it says ...
1
vote
1answer
388 views

Query posts from category based on a filter most favorited

I have one question. I need to query posts from category based on the filter most favorited ( http://pastie.org/2751114 ) which is placed in custom_sort.php to my index.php page This is how the posts ...
1
vote
1answer
184 views

How to take options from form fields and turn them in to links?

I have a form in WordPress with options when clicked they retrieve a filtered posts. I want to take the options from the form and place it like normal links. Can this be done? Thank You all in advance ...
1
vote
1answer
86 views

Add filter problems

I am confused about filters, why does this work: function get_the_author_description2() { return 'test'; } add_filter('get_the_author_description', 'get_the_author_description2'); but this one ...
0
votes
1answer
649 views

Filter media upload attachment meta

I'm trying to determine a way to access the meta data for an image when it is first uploaded with the media uploader. Looking at the media_handle_upload() function in /wp-admin/includes/media.php I ...
0
votes
1answer
580 views

How can I apply filters in my class that extends Walker_Nav_Menu?

I have the following piece of abridged code: <?php class New_Walker_Nav_Menu extends Walker_Nav_Menu { function start_el(&$output, $item, $depth, $args) { $attributes = ! empty( ...