Articles of filters

remove/hide wp-editor

I have created a meta-box for a certain page_template. So if the adminpage is loaded with the template it shows the metabox. This does not require the wp-editor to add content. So I would like to hide or disable it. I have searched the interwebs but they all came up with the disablement of the […]

How to override filter in child theme?

I’m trying to override a parent theme filter in a child theme; I must have the syntax wrong as the override is being completely ignored. Here’s what’s in my child theme’s functions.php: //* remove and replace parent filter function child_remove_parent_function() { remove_filter(‘filter_name’,’parent_function’); } add_filter(‘filter_name’,’child_function’); //* my custom function function child_function($link){ //* function code here return […]

Change Password Strength Indicator names?

Is it possible to change the labels for “Weak, Medium, Strong” etc… in the Password Indicator that’s used in the user profile? I’ve been asked to change the word “Weak” to “OK” since this level of passwords is acceptable for our subscribers. Is there a filter I can hook into?

Filter existing hook using parameter and foreach loop

I am trying to create a filter to add a custom column to the edit page of any custom category that might exist in WordPress. I am aware that the filter hook must be in the form, manage_edit-{$cat}_columns. Lets say that this is the function to add: /* Add custom column to lists */ function […]

`authenticate` filter never gets called

I’ve added and network activated a plugin with this code: add_filter(‘authenticate’, ‘my_authenticate’, 1000, 2); function my_authenticate($user, $username){ // We never arrive in this function From a debugger I can see that we hit the add_filter line but we never enter the my_authenticate function. Why’s that? And how do I fix the problem?

Access or edit custom generated permalinks with WP_Rewrite

I want to create custom permalinks for my plugin using WP_Rewrite. I found the codex the have great examples and this stack topic also explained a lot to me. Currently I’ve got the following code based on the codex and update 3 from the stack overflow question: add_filter( ‘rewrite_rules_array’, ‘custom_permalinks’ ); add_filter( ‘query_vars’, ‘custom_query_vars’ ); […]

Using preg_replace() with the_content filter

I am trying to append a php query to the end of links from my website to a sponsor site using the_content filter and preg_replace(). I have tested my regex expression on and it works also I have used print_r() to test that the function is being called but for some reason the links […]

Customize title, description and focused keyword

I would like to customize focused keyword, SEO title and meta description, but I am unable to find any clue how to do it. There is official documentation but it is sooo lacking… I came up with this for changing title, but this is directly changing the title for a page, it won’t affect meta […]

Passing variable in hooks and filter

I was trying to pass variables in filtes. This works perfectly for me. class my_class { function my_class() { add_filter(‘wp_list_categories’, array(&$this,’cat_count_span’)); } function cat_count_span($links) { $links = str_replace(‘</a> (‘, ‘</a> <span>’, $links); $links = str_replace(‘)’, ‘</span>’, $links); return $links; } } new my_class(); But now I want to execute the filter based on theme options […]

Adding html banner to posts

I’m writing a plugin that adds a banner to the top of all blog posts. I’m using the_content filter and just pre-pending some html to it. When doing this, the html isn’t shown in the excerpt, but I want the banner to be there. What do I need to do? I don’t want to allow […]