Fonksiyon daha önce oluşturulduğu içinde olabilir farklı bir isim verip deneyebilir misiniz hocam?
[COLOR=#515365][FONT=consolas]function update_focus_keywords2() {[/FONT][/COLOR]
[COLOR=#515365][FONT=consolas] $posts = get_posts(array([/FONT][/COLOR]
[COLOR=#515365][FONT=consolas] 'posts_per_page' => -1,[/FONT][/COLOR]
[COLOR=#515365][FONT=consolas] 'post_type' => 'post' // Replace post with the name of your post type[/FONT][/COLOR]
[COLOR=#515365][FONT=consolas] ));[/FONT][/COLOR]
[COLOR=#515365][FONT=consolas] foreach($posts as $p){[/FONT][/COLOR]
[COLOR=#515365][FONT=consolas] // Checks if Rank Math keyword already exists and only updates if it doesn't have it[/FONT][/COLOR]
[COLOR=#515365][FONT=consolas] $rank_math_keyword = get_post_meta( $p->ID, 'rank_math_focus_keyword', true );[/FONT][/COLOR]
[COLOR=#515365][FONT=consolas] if ( ! $rank_math_keyword ){[/FONT][/COLOR]
[COLOR=#515365][FONT=consolas] update_post_meta($p->ID,'rank_math_focus_keyword',strtolower(get_the_title($p->ID)));[/FONT][/COLOR]
[COLOR=#515365][FONT=consolas] }[/FONT][/COLOR]
[COLOR=#515365][FONT=consolas] }[/FONT][/COLOR]
[COLOR=#515365][FONT=consolas]}[/FONT][/COLOR]
[COLOR=#515365][FONT=consolas]add_action( 'init', 'update_focus_keywords2' );[/FONT][/COLOR]gibi.
functions.php'ye eklemeyi denediniz mi ?
Sayfanın en üstüne aşağıdaki kodu eklediğinizde 500 hatasının php çıktısını görebilmeniz lazım.
ini_set('display_errors',1);
error_reporting(E_ALL);
Kodda bir hata göremedim ancak eklediğiniz yer autoload olmuyor olabilir. Çalıştığınız PHP dosyasına include rtrim($_SERVER['DOCUMENT_ROOT'],'/') . '/wp-load.php'; kodunu ekleyip öyle çalışmayı deneyin.
Bu kodu sadece şu andan sonra eklediğim makalelerde çalışacak şekilde dizayn edebilecek birisi var mı acaba ? Kodu eklemeden önceki makaleleri ellemeyecek yani. ( Ücretli )