Why isn’t this add_filter function working as expected?

apply_filters( $tag, $value, $param, $otherparam ) This is how the apply_filters function work. By default, the value is printed if no function is hooked with the filter. It’s not clear what directorist_icon( ‘fas fa-chevron-right’, false ) prints here. But if it is showing “next” string at the output, the filter is working right. If you … Read more

Can you call a filter hook by “add_action”?

add_action() and add_filter() are the same function. If you look at the source you’ll see that add_action() just calls add_filter(). So yes, this it is technically possible to register a filter callback with add_action(). The difference between an action and a filter is that filters expect a return value, while actions do not. This is … Read more

Filter and manipulate the get_current_user() function

From what I’m seeing in the github repo. get_current_user doesn’t exist. What you do have is wp_get_current_user, this function does this return _wp_get_current_user(); So now I checked what _wp_get_current_user does. It checks a global variable $global_user, if it’s not empty, return an instance of it (didn’t find any actions for that). If empty it does … Read more

How to change this WP logo and posts url in block editor?

You can change the logo in the block editor or site editor using the SlotFill system. Have a look at the this example code taken from https://developer.wordpress.org/block-editor/reference-guides/slotfills/main-dashboard-button/ import { registerPlugin } from ‘@wordpress/plugins’; import { __experimentalMainDashboardButton as MainDashboardButton } from ‘@wordpress/edit-post’; const MainDashboardButtonTest = () => ( <MainDashboardButton> Custom main dashboard button content </MainDashboardButton> ); … Read more

Modify the third (context) parameter in a filter?

You can’t modify the parameters of a filter like that, that’s not what they’re there for. In the source code it’ll look something like this: $cookie = apply_filters( $cookie, $user_id, $expiration, $scheme, $token ); It’s explicitly looking for the value of $cookie. If you return the value for $expiration, things will break. The extra parameters … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)