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
Fix Plugin Conflict with Give plugin (previously created 500 server error when viewing site admin) #1725
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
|
@googlebot I've signed it! |
CLAs look good, thanks! |
@@ -1894,7 +1894,10 @@ public static function print_url_as_title( $post ) { | |||
* | |||
* @return string Title. | |||
*/ | |||
public static function filter_the_title_in_post_list_table( $title, $post ) { | |||
public static function filter_the_title_in_post_list_table( $title, $post = '' ) { | |||
if($post == ''){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@KZeni I found that this function is a callback for the_title
hook. In that can we need to update the following thing:
- The second parameter for
the_title
filter inint
type, so set default value to0
: https://core.trac.wordpress.org/browser/tags/5.0/src/wp-includes/post-template.php#L158 - According to point 1, you can also update
$post
param value type toint
instead ofWP_Post
in function description comment block. - Use trinary condition
$post = empty( $post ) ? get_post() : $post
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found we can simply further. Since $post
is only used by get_post_type()
, and since this function takes null|int|WP_Post
as its type, then we just have to provide an empty default value for $post
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for the PR and identifying the problem in the first place.
Please try my alternative patch included here. It will also fix the build error reported by Travis: https://travis-ci.org/ampproject/amp-wp/jobs/466619023#L186
public static function filter_the_title_in_post_list_table( $title, $post = '' ) { | ||
if($post == ''){ | ||
$post = get_post(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest the following change instead:
- public static function filter_the_title_in_post_list_table( $title, $post ) {
+ public static function filter_the_title_in_post_list_table( $title, $post = null ) {
See also #1723. |
I'm rebasing this PR against the |
…rror when viewing site admin) See additional details here: ampproject#1720
@KZeni could you please double check that the PR fixes the problem as it stands at the moment? |
@westonruter I can confirm that the PR as it stands (
) is working on my end with both AMP and Give enabled on the site & viewing the site admin. |
Fixes #1720.