Changing a WordPress core function without hacking core

You aren’t filtering correctly. Firstly, you aren’t passing variables to the function, so your function has no way of knowing what $comment_author is, etc. If you had debug mode enabled you’d probably get errors about undefined variables. Secondly, you need to return a value. Untested, but seems like it ought to work: add_filter(‘pre_comment_approved’, ‘custom_blacklist’, 10, … Read more

What hook/filter can I use to add/edit/show/hide the title under (on hover) links on the table view?

You will want to use the post_row_actions filter https://developer.wordpress.org/reference/hooks/post_row_actions-2/ For example, to add a link, you could try something like: function add_custom_link($actions, $page_object) { $actions[‘custom_link’] = ‘<a href=”http://www.example.com”>My Custom Link</a>’; return $actions; } add_filter(‘post_row_actions’, ‘add_custom_link’, 10, 2);

Adding Filter Conditionally Per Page ID

It’s important to always return the value in filter callbacks, otherwise it’s like adding the __return_null() callback. Here’s an example that adds the blog class only to page with ID 40: add_filter( ‘body_class’, ‘add_blog_to_body_class’ ); function add_blog_to_body_class( $classes ) { if ( is_page( 40 ) ) $classes[] = ‘blog’; return $classes; }

Changing Order of Filters

add_filter() has other 2 optionals parameters (same for add_action()), the priority (default set to 10, and lower numbers correspond with earlier execution) and the number of args (default to 1). You need to set your filter with the priority with an higher priority than the other plugin, assuming the other has its priority to the … Read more

Filtering admin entries for custom post type

You can use the pre_get_posts hook – the following code assumes your input name is event_date, and the values are in the format YYYY-MM. It runs a few checks (is the input non-empty, are we in the admin, is this the main query, and is this for events?) before generating a meta query, which is … Read more

How to check if “media_send_to_editor” is audio?

We can simplify the mime type checks, with the following boolean functions: wp_attachment_is( ‘image’, $id ) wp_attachment_is( ‘video’, $id ) wp_attachment_is( ‘audio’, $id ) where $id is the attachment ID. The attachment’s ID is actually one of the input arguments for the media_send_to_editor filter callback. We also have: wp_attachment_is_image( $id ) that’s a wrapper for … Read more

How can override a add_filter of a plugin?

Filters come with a priority parameter, the default is 10, so to override a function you need to increase the priority: add_filter( ‘wcml_switch_currency_exception’, ‘cart_switching_currency’, 99, 4 ); add_filter( string $tag, callable $function_to_add, int $priority = 10, int $accepted_args = 1 ) More info in the add_filter Update: If removing a filter is not working you … Read more

Filter Gutenberg Blocks Content

Have you tried using parse_blocks() (pass in get_the_content())? That returns an array of all the blocks in your content. From there you can pull out block names and id attributes using an array map or foreach. Assuming you only want to pull anchor tags from the headings, you could do something like: $blocks = parse_blocks( … Read more

Sensei LMS Hooks to Remove Content

Just add below code in functions.php for remove action. add_action( ‘init’, ‘remove_hooks’, 11 ); function remove_hooks(){ remove_action(‘sensei_single_course_content_inside_before’,array(‘Sensei_Course’,’the_course_video’),40); } i have tested this and it is working for me. let me know if this works for you.

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