Учитывая следующую функцию, как я могу добавить apply_filter к его ответу? У меня была тема, и, к сожалению, она обновилась и больше не имеет фильтра.
public function Episodes($tmdb = '', $season = '', $episode = '', $name = '', $edit = ''){
// Verify all Strings
if($tmdb && $season && $episode && $name){
// Start timer
$mtime = microtime(TRUE);
// Verify nonexistence
if(!$this->VeryTMDbEP($tmdb, $season, $episode) || $this->repeatd == true){
// Api Parameters TMDb
$tmdb_args = array(
'append_to_response' => 'images',
'language' => $this->apilang,
'include_image_language' => $this->apilang.',null',
'api_key' => $this->tmdbkey,
);
// Remote Data TMDb
$json_tmdb = $this->RemoteJson($tmdb_args, DBMOVIES_TMDBAPI.'/tv/'.$tmdb.'/season/'.$season.'/episode/'.$episode);
// Verify Status code
if(!$this->Disset($json_tmdb,'status_code')){
// Compose TMDb Data TVShow > Season > Episode
$tmdb_name = $this->Disset($json_tmdb,'name');
$tmdb_air_date = $this->Disset($json_tmdb,'air_date');
$tmdb_season_number = $this->Disset($json_tmdb,'season_number');
$tmdb_spisode_number = $this->Disset($json_tmdb,'episode_number');
$tmdb_overview = $this->Disset($json_tmdb,'overview');
$tmdb_still_path = $this->Disset($json_tmdb,'still_path');
$tmdb_images = isset($json_tmdb['images']['stills']) ? $json_tmdb['images']['stills'] : false;
$tmdb_upimage = isset($tmdb_still_path) ? 'https://image.tmdb.org/t/p/w500'.$tmdb_still_path : false;
// Compose Images
$images = '';
if($tmdb_images){
$image_count = 0;
foreach($tmdb_images as $image) if($image_count < 10){
if($image_count == 9){
$images.= $this->Disset($image,'file_path');
}else{
$images.= $this->Disset($image,'file_path')."\n";
}
$image_count++;
}
}
// Preparing Title
$data_name = array('name' => $name, 'season' => $tmdb_season_number, 'episode' => $tmdb_spisode_number);
$opt_title = $this->get_option('titlepisodes','{name}: {season}x{episode}');
// Post data
$post_data = array(
'ID' => $edit,
'post_status' => $this->get_option('pstatusepisodes','publish'),
'post_author' => $this->SetUserPost(),
'post_title' => $this->TextCleaner($this->Tags($opt_title,$data_name)),
'post_content' => $tmdb_overview ? '<!-- wp:paragraph --><p>'.$this->TextCleaner($tmdb_overview).'</p><!-- /wp:paragraph -->' : false,
'post_type' => 'episodes'
);
// Insert Post
if(!empty($edit)){
$post_id = wp_update_post($post_data);
}else{
$post_id = wp_insert_post($post_data);
}
// WordPress No Error
if(!is_wp_error($post_id)){
// Set Data
$insert_postmeta = array(
'ids' => $tmdb,
'temporada' => $tmdb_season_number,
'episodio' => $tmdb_spisode_number,
'serie' => $name,
'episode_name' => $tmdb_name,
'air_date' => $tmdb_air_date,
'imagenes' => $images,
'dt_backdrop' => $tmdb_still_path,
);
// Add Postmeta
foreach($insert_postmeta as $meta => $value){
if($meta == 'imagenes'){
if(!empty($value)) add_post_meta($post_id, $meta, esc_attr($value), false);
}else{
if(!empty($value)) add_post_meta($post_id, $meta, sanitize_text_field($value), false);
}
}
// Upload Poster
if(!empty($tmdb_upimage)) $this->UploadImage($tmdb_upimage, $post_id, true, false);
// Detele Cache
dbmovies_clean_tile($tmdb);
############################################################
$response = array(
'response' => true,
'editlink' => admin_url('post.php?post='.$post_id.'&action=edit'),
'permalink' => get_permalink($post_id),
'title' => get_the_title($post_id),
'mtime' => $this->TimeExe($mtime)
);
############################################################
} else {
$response = array(
'response' => false,
'message' => __d('Error WordPress')
);
}
} else {
$response = array(
'response' => true,
'message' => $this->Disset($json_tmdb,'status_message')
);
}
} else{
$response = array(
'response' => true,
'mtime' => $this->TimeExe($mtime),
'message' => __d('This episode already exists in database')
);
}
} else {
$response = array(
'response' => false,
'message' => __d('Complete required data')
);
}
// Json Response composer
return $response;
}
Старый Json Ответ composer был:
return apply_filters('your_fav_filter', $this->ResponseJson($response), $tmdb.$season.$episode);
, и он прекрасно работал.
PS. your_fav_filter не упоминался ни в одном другом файле, и единственная мысль, которая была изменена в теме, была последней строкой. (ответ json)
Спасибо!