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

! get_custom_header() in Custom_Header_Integration has no meaning #240

Closed
szepeviktor opened this issue Feb 4, 2020 · 3 comments
Closed

Comments

@szepeviktor
Copy link
Contributor

szepeviktor commented Feb 4, 2020

get_custom_header returns an object, so ! object it always false.

Discovered by @phpstan on Level 4

@westonruter
Copy link
Collaborator

Are you referring to this code:

$header = get_custom_header();
$attachment = ! empty( $header->attachment_id ) ? get_post( get_custom_header()->attachment_id ) : null;

It's checking that the attachment_id is set, not the object as a whole.

@szepeviktor
Copy link
Contributor Author

Rather this one:

public function register( WP_Service_Worker_Scripts $scripts ) {
if ( ! current_theme_supports( 'custom-header' ) || ! get_custom_header() ) {
return;
}

@westonruter
Copy link
Collaborator

The integrations will be deprecated per #403 so I'm closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants