Articles of filters

How to append custom text to the output of 'categories widget'?

How do I customize the “categories widget” to append additional text on the sidebar display? from category 1 category 2 category 3 category 4 to category 1 folder category 2 folder category 3 folder category 4 folder Without actually modifying the category name in the database, I would like to add some actual customized text […]

How to hide some categories in dashboard

Is there a way to hide some categories in the dashboard for some users/roles so they won’t appear? It should affect both the dropdown menu in the post list and the category checkbox selector in the post page: and

WP 4.5 hide core customizer sections

Since WP 4.5 the way you hide core components from the customizer was changed. Changed from $wp_customize->remove_panel() to customize_loaded_components. customize_loaded_components The two examples in the above link works but if I try it on any of the other core sections of the customizer such as Site Identity(ID:title_tagline) or Header Image(ID:header_image) it doesn’t work. Works: function […]

What is the action hook to use if you want to capture the new password during password change?

Clicking the Update Profile button in the [wordpress]/wp-admin/profile.php admin screen will allow the user to update his/her profile including the password. What is the right action hook to use if you want to capture the new password during this password change?

Get_template_part inside filter?

Is it possible to remove gallery from content but in its place do get_template_part(‘content-gallery’); ? I have this piece of code which removes gallery from post but I am inserting content-gallery.php which grabs and formats gallery the way I wanted to. This works nice but gallery is inserted at the end of the post what […]

Want to use wp_get_current_user() in query filter

I am using the WP “query” filter and in my function I want to use wp_get_current_user(). But I get a fatal error when I call it. Because the function isn’t loaded by WP yet. Is there a fix. ? public function __construct() { add_filter(‘query’, array($this,’my_func’), 10, 1); } function my_func($param){ $current_user = wp_get_current_user(); // Getting […]

How to have free shipping for WooCommerce Membership members

I was wondering if anyone had come up with a viable workaround to provide free shipping on products that are sold to members. The only possibility I can think of at the moment is to have two separate product offerings for each product – one for members and on for the public. But that would […]

How to add Shortcode (font awesome) in widget title?

I want to show font awesome icon (installed) on the left side of the WordPress widget title. I found this shortcode that should do the work. add_filter( ‘widget_title’, ‘do_shortcode’ ); add_shortcode( ‘icon’, ‘shortcode_fa’ ); function shortcode_fa($attr, $content ) { return ‘<i class=”fa fa-‘. $content . ‘”></i>’; } After adding this in functions.php, I should be […]

How to include add_filter() in a condition based on $post data

I’m writing a plugin that has a custom page for displaying user stats: example.com/user/admin/ has a custom permalink structure that takes the reader to the /user/ page and display the data for the ‘admin’ user. Meanwhile, example.com/user/ should just return a list of all registered users. What I have done (that works) is have a […]

Include HTML (Bootstrap Modal Box) with a plugin into my header

I want to include some HTML, spezific a bootstrap modal box. This is my function with the HTML part: public function dmd_fav_modal_box() { $content = ‘<div class=”modal fade” id=”dmd_favorite_modal” tabindex=”-1″ role=”dialog” aria-labelledby=”dmd_favorite_modalLabel”> <div class=”modal-dialog” role=”document”> <div class=”modal-content”> <div class=”modal-header”> <button type=”button” class=”close” data-dismiss=”modal” aria-label=”Close”><span aria-hidden=”true”>&times;</span></button> </div> <div class=”modal-body”> <p>Test</p> </div> <!–div class=”modal-footer”> <button type=”button” class=”btn […]