Articles of filters

How to Prevent WordPress to encode html in post?

As as title, how to prevent wp not to encode html in a post? currently i just need to prevent ‘&’ changed to & The result need to be looks like on editor with html tab mode selected. $content = $wpdb->get_row(“SELECT post_content FROM $wpdb->posts WHERE ID=xxx”); $content = str_replace(‘amp;’,”,$content->post_content);//remove amp; $wpdb->query(“UPDATE $wpdb->posts SET post_content = […]

Filter Text from sidebar widget?

Hey guys, I’m using a calendar plugin that provides a sidebar widget to show current calendar dates. However this widget always shows N/A if I don’t set a category for a specific event. Any idea how I could add a filter to that widget and match N/A and remove it? thank you for your help

Filtering posts on Post Administration Page by Week Number instead of by Month

Has anyone written or can suggest a plugin that would replace the filter-by-month in the Post Administration screen with filter-by-week-number instead? e.g. a drop down option for “Week of 05/31-06/06, 2011”

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 “Home”. I’d like it to say “About Us”. I want the user to know which […]

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 can’t see any filters before the meta data is sent to wp_insert_attachment() wp_update_attachment_metadata(). Sure, I can filter the meta inside using the ‘wp_update_attachment_metadata’ filter. […]

Prepending character(s) to a custom <!–more–> tag title?

I’m hacking around with a blog using Cordobo Green Park and I’ve noticed when I specify a custom title, instead of it beginning with a » symbol (as it does for the standard “» Read more: [POSTTITLE]“) the custom message is simply shown without any prepended character. It’s a shame, because the » character would […]

How to remove the RichText Meta Box

How can I remove the rich text box editor in WordPress? I have used the remove_meta_box function specifying the boxes ID, but it does not work like it does for other core meta boxes: The code I tried: function remove_rich_box() { remove_meta_box(‘postdivrich’, ‘client’, ‘normal’); } add_action( ‘do_meta_boxes’, ‘remove_rich_box’ ); Where the second paratmeter “client” is […]

Is it possible to add an argument to a custom function added to a filter hook?

Example: I’m trying to modify an instantiation of WP_Query by using the posts_orderby filter like so: add_filter(‘posts_orderby’, ‘favorites_orderby’); $new_query = new WP_Query($args); remove_filter(‘posts_orderby’, ‘favorites_orderby’); the favorites_orderby() function is like so: function favorites_orderby($post_in){ if(is_array($post_in)) $post_in_str = implode(‘,’, $post_in); return $post_in_str; } $post_in is an array that changes based on a previous, separate db query, so I […]

Filter have_posts()/ the_post()

What is the best way to filter the posts being displayed? For example in my functions.php file I want to have something like add_filter( $tag, ‘filter_posts’); function filter_posts(){ if(is_home()){ //return custom post query that will be used in loop } }

How can I remove filters from custom post types?

I created a custom post type which I’ll use as landing page for PPC. Now on that custom post type I would like to remove all the filters which are adding the social media buttons for example. I tried already with the following code but that did also remove the shortcode filter which I would […]