Change user nicename without sanitize

The title is being converted to lowercase by filter sanitize_title // in wp-includes/default-filters.php add_filter( ‘sanitize_title’, ‘sanitize_title_with_dashes’, 10, 3 ); // it means => calling sanitize_title_with_dashes() in wp-includes/formatting.php Here is explanation to what can do, recommended and not recommended method Not Recommended You may remove this filter but not recommmended Because this filter is for converting … Read more

Remove Comment Author Link only for subscribers

This doesn’t feel very nice since it calls get_comment() and get_userdata(), but I’m not sure there’s an obvious better way since the code that calls this doesn’t pass in the records we need: function remove_comment_author_link( $return, $author, $comment_ID ) { $comment = get_comment( $comment_ID ); if ( $comment && $comment->user_id ) { $user = get_userdata( … Read more

Modify existing plugin function with add_filter

So you’re half way there with the code you have, you’re only missing a small part which is that your filter function takes information about what it’s filtering through function parameters, can then make changes to the thing that’s being filtered (or not) and then must pass that back out (return it). I.e. In this … Read more

How should I be using filters and is_single together?

You can do this in functions.php, but you have to make sure the function is hooked into wp. Any earlier than that and is_single is undefined. Try adding this to functions.php: /** * Unhooks sixtenpresssermons_get_meta from the_content if currently on single post. */ function sx_unhook_sixtenpresssermons_get_meta() { // Do nothing if this isn’t single post if … Read more

filter hook to load a different post/page on current post/page

You can use the request hook to change the loaded page for the same URL: add_filter( ‘request’, function( $request ){ //Replace this with custom logic to determine if the user should see the contact-team page $load_team_contact = true; if( $load_team_contact && isset( $request[‘pagename’] ) && ‘contact’ == $request[‘pagename’] ){ $request[‘pagename’] = ‘contact-team’; } return $request; … Read more

How to hide/remove GhostKit component panel in gutenberg block inspector

Ok, nevermind, I found solution I’ve tried removeFilter( ‘editor.BlockEdit’, ‘ghostkit/sr/additional-attributes’ ); but it was not working inside my plugin, but it worked in console, so then I found out, that I need to hook this to something, so this is working solution addAction( ‘plugins.pluginRegistered’, ‘kubiq/remove-ghostkit-animations’, function( settings, name ){ if( name == ‘ghostkit’ ){ removeFilter( … Read more