Most people use apple_news_skip_post
and then apply their custom logic there.
Thread Starter
John
(@johnmcole)
Thank you Bradford. Something like this?
function custom_apple_news_skip_push( $params ) {
if ($this->id == ...) {
return true;
} else {
return false;
}
}
add_filter( 'apple_news_skip_push', 'custom_apple_news_skip_push' );
What parameters the does apple_news_skip_push filter expect?
Sure, something like that. However, the filter passes two params. The first is the boolean value (all filters pass the value to be modified as the first param) and the second is the post ID. Unless you were just intending params to be pseudocode there.
In any case, I think you get the gist of it.
Thread Starter
John
(@johnmcole)
Cool. That’s what I was wondering. Thanks for the help!
Thread Starter
John
(@johnmcole)
Hi Bradford,
Do you see any issues with this code? I’m not familiar with all of the ins and outs of the plugin and I want to make sure it’s not going to break something else.
function gp_apple_news_skip_push($skip, $post_id) {
$apple_news_id = get_post_meta( $post_id, 'apple_news_api_id', true );
if ( ! empty( $apple_news_id ) ) {
return $skip;
}
if (strpos(get_the_title($post_id), 'FTA:') === 0) {
$skip = true;
}
return $skip;
}
add_filter( 'apple_news_skip_push', 'gp_apple_news_skip_push', 10, 2 );
Yes, should work though I’d obviously test it on your end first.