edit_post_link filter
-
Hi there,
I’ve created a child theme for Storefront and added this filter to hide the edit link on given page :
add_filter(
'edit_post_link',
function( $link, $post_id, $text ) {
$post = get_post($post_id);
$slug = $post->post_name;
if ( 'my-slug' === $slug ) {
return '';
}
return $link;
}
);But that gives me a ? Uncaught ArgumentCountError ? fatal error :
PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function {closure}(), 1 passed in /www/wp-includes/class-wp-hook.php on line 326 and exactly 3 expected in /www/wp-content/themes/storefront-child/functions.php:24
Stack trace:
#0 /www/wp-includes/class-wp-hook.php(326): {closure}()
#1 /www/wp-includes/plugin.php(205): WP_Hook->apply_filters()
#2 /www/wp-includes/link-template.php(1542): apply_filters()
#3 /www/wp-content/themes/storefront/inc/storefront-template-functions.php(519): edit_post_link()
#4 /www/wp-includes/class-wp-hook.php(324): storefront_edit_post_link()
#5 /www/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#6 /www/wp-includes/plugin.php(517): WP_Hook->do_action()
#7 /www/wp-content/themes/storefront/content-page.php(18): do_action()
#8 /www/wp-includes/template.php(812): require('...')
#9 /www/wp-includes/template.php(745): load_template()
#10 /www/wp-includes/general-template.php(206): locate_template()
#11 /www/wp-content/themes/storefront/page.php(24): get_template_part()
#12 /www/wp-includes/template-loader.php(106): include('...')
#13 /www/wp-blog-header.php(19): require_once('...')
#14 /www/index.php(17): require('...')
#15 {main}
thrown in /www/wp-content/themes/storefront-child/functions.php on line 24Maybe I’m doing something wrong but I have a feeling that Storefront is messing this filter up.
Kind regards,
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.