Beschreibung
add_action('save_post_job_listing', 'dl24_auto_seo_and_image', 20, 3);
function dl24_auto_seo_and_image($post_id, $post, $update) {
if (wp_is_post_autosave($post_id) || wp_is_post_revision($post_id)) return;
if ($post->post_status !== 'publish') return;
if (!class_exists('MyListingSrcListing')) return;
$listing = MyListingSrcListing::get($post_id);
if (!$listing) return;
$title = get_the_title($post_id);
// Kategorie
$categories = wp_get_post_terms($post_id, 'job_listing_category');
$category = !empty($categories) ? $categories[0]->name : '';
// Region
$regions = wp_get_post_terms($post_id, 'region');
$region = !empty($regions) ? $regions[0]->name : '';
// Tagline
$tagline = trim($listing->get_field('tagline'));
// -------------------------
// 🔥 SEO TITEL VARIANTEN
// -------------------------
$title_variants = [];
if ($category && $region) {
$title_variants = [
$category . ' in ' . $region . ' – ' . $title,
$title . ' | ' . $category . ' ' . $region,
$category . ' ' . $region . ' – ' . $title,
$title . ' in ' . $region . ' | ' . $cate
Bewertung hinzufügen