'object', 'properties' => array( 'post_id' => array( 'type' => 'integer', 'description' => 'The post ID to resolve the breadcrumb trail for', ), ), 'required' => array('post_id'), ); } /** * @inheritDoc */ public function execute($params) { $this->validate_params($params); $this->require_capability('edit_posts'); $post_id = intval($params['post_id']); $this->check_post_permission($post_id); $this->verify_post_exists($post_id); $breadcrumbs = new Metasync_Breadcrumbs(); $trail = $breadcrumbs->resolve_breadcrumb_trail($post_id); if (!function_exists('is_plugin_active')) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $payload = array( 'post_id' => $post_id, 'trail' => $trail, 'trail_count' => count($trail), 'custom_label' => get_post_meta($post_id, '_metasync_breadcrumb_title', true), ); if (is_plugin_active('wordpress-seo/wp-seo.php') || is_plugin_active('wordpress-seo-premium/wp-seo-premium.php')) { $payload['yoast_label'] = get_post_meta($post_id, '_yoast_wpseo_bctitle', true); } if (is_plugin_active('seo-by-rank-math/rank-math.php') || is_plugin_active('seo-by-rankmath/rank-math.php')) { $payload['rankmath_label'] = get_post_meta($post_id, 'rank_math_breadcrumb_title', true); } return $this->success($payload); } }