Home Forums Bug Reports Missing Arguments in default_page_template_title


Missing Arguments in default_page_template_title

  • Running ACF Pro 5.7.12 and we’re using the default_page_template_title filter in our theme to change the title of the default template from “Default” to “Article”.

    All works fine with the post metabox.

    However, when using ACF and trying to set a location rule on an ACF Field Group with a Post Template equal to, we get a PHP error:

    Fatal error: Uncaught ArgumentCountError: Too few arguments to function mg_post_template_default_title(), 1 passed in /wp-includes/class-wp-hook.php on line 286 and exactly 2 expected...

    We can fix this error by altering line 134 in advanced-custom-fields-pro/includes/locations/class-acf-location-post-template.php from

    'default' => apply_filters( 'default_page_template_title', __('Default Template', 'acf') )


    'default' => apply_filters( 'default_page_template_title', __('Default Template'), 'acf')

    Is this a bug or is there something else going on that we’re missing?


    __('Default Template', 'acf')

    is there to translate the text value. ACF is not passing a $context, which is optional. You need to assume a default or ignore that parameter.

    add_filter('default_page_template_title', 'mg_post_template_default_title', 10, 1);


    function mg_post_template_default_title($label, $context="") {
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Missing Arguments in default_page_template_title’ is closed to new replies.