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

The apple_news_exporter_title filter changes the title component, but not the title #1213

Open
seanrasmussen opened this issue Jan 15, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@seanrasmussen
Copy link

Description

We're wanting to use different titles for Apple News. The apple_news_exporter_title successfully filters the title component on the article, but leaves the title that apple sees untouched. Which means that Apple's editorial isn't seeing the Apple-optimized titles.

Use Case

I'd like it if the apple_news_exporter_title filter changed both the title component and the actual title.

@seanrasmussen seanrasmussen added the enhancement New feature or request label Jan 15, 2025
@seanrasmussen
Copy link
Author

seanrasmussen commented Jan 16, 2025

So, I found that I can use the apple_news_generate_json filter to do what I want. However, I feel like the apple_news_exporter_title is confusingly documented, and should probably function to change both: the component with the role of "title", and also the "title" in the JSON. Here's the function I used:

/**
 * Push different title to apple.
 */
function alter_apple_json_output( $json ) {

	if ( get_field( 'apple_news_alternate_title' ) ) {
		$json['title'] = get_field( 'apple_news_alternate_title' );
	}
	return $json;
}
add_filter( 'apple_news_generate_json', 'alter_apple_json_output' );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant