Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a second argument to the_title filter to prevent fatal error #3899

Merged
merged 2 commits into from Dec 12, 2018

Conversation

kienstra
Copy link
Contributor

@kienstra kienstra commented Dec 11, 2018

Description

This prevents a fatal error

How Has This Been Tested?

Steps to reproduce

  1. Activate this plugin, and add a donation if one doesn't exist:
    /wp-admin/post-new.php?post_type=give_forms
  2. Activate and install the AMP for WordPress plugin (here's a built branch of v1.0.0)
  3. In /wp-admin > AMP > Template Mode, select "Paired," and click "Save Changes"
  4. Expected: the page reloads
  5. Actual: there's a fatal error:

fatal-error-in-wp-admin

With this PR, there's no error.

Background

The fatal error is reported for AMP_Validated_URL_Post_Type:: filter_the_title_in_post_list_table(), as that filters the_title.

It has 2 parameters, as the documentation for the_title requires. But the apply_filters() call here only passes it 1 argument.

Types of changes

Bug fix

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows has proper inline documentation.

For #3895

Before, there was an error when another plugin adds
a 'the_title' filter that has 2 arguments,
as this only passes 1 argument.
So add the post ID to prevent this.
@ravinderk ravinderk merged commit bde93d9 into impress-org:release/2.3.1 Dec 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants