Skip to content

Instantly share code, notes, and snippets.

@XTechnology-TR
Last active September 19, 2024 11:35
Show Gist options
  • Save XTechnology-TR/055be110bb5066f6f4a3abdf7494be9e to your computer and use it in GitHub Desktop.
Save XTechnology-TR/055be110bb5066f6f4a3abdf7494be9e to your computer and use it in GitHub Desktop.
PHP Uyarısı: Tanımsız dizi anahtarı (seo-by-rank-math-pro)
Şu dosyada ki _/wp-content/plugins/seo-by-rank-math-pro/includes/modules/analytics/class-posts.php_
ranking_keyword_array_sort Fonksiyonu aşağıdakilerle güncelledim:
```
public function ranking_keyword_array_sort( $arr, $arr_order, $arr_orderby ) {
if ( 'DESC' === $arr_order ) {
uasort(
$arr,
function( $a, $b ) use ( $arr_orderby ) {
$a_total = isset($a[$arr_orderby]) && is_array($a[$arr_orderby]) && isset($a[$arr_orderby]['total']) ? $a[$arr_orderby]['total'] : 0;
$b_total = isset($b[$arr_orderby]) && is_array($b[$arr_orderby]) && isset($b[$arr_orderby]['total']) ? $b[$arr_orderby]['total'] : 0;
return $a_total < $b_total;
}
);
}
if ( 'ASC' === $arr_order ) {
uasort(
$arr,
function( $a, $b ) use ( $arr_orderby ) {
$a_total = isset($a[$arr_orderby]) && is_array($a[$arr_orderby]) && isset($a[$arr_orderby]['total']) ? $a[$arr_orderby]['total'] : 0;
$b_total = isset($b[$arr_orderby]) && is_array($b[$arr_orderby]) && isset($b[$arr_orderby]['total']) ? $b[$arr_orderby]['total'] : 0;
return $a_total > $b_total;
}
);
}
return $arr;
}
```
Şimdilik hatalar çözülmüş gibi görünüyor, eminim Rankmath Pro'nun bu sorun için bir düzeltme yayınlaması gerekecektir.
Güncellediğim fonksiyonda sadece dizi içerisinde değer olup olmadığını kontrol ediyor, böylece uyarı vermiyor.
Umarım yardımcı olur!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment