| @@ -12,9 +12,9 @@ | ||
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * The transient cache key. |
| 15 | 15 | */ |
| 16 | - const TRANSIENT_CACHE_KEY = 'wpseo_semrush_related_keyphrases_%s_%s'; | |
| 16 | + public const TRANSIENT_CACHE_KEY = 'wpseo_semrush_related_keyphrases_%s_%s'; | |
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * The SEMrush keyphrase URL. |
| 20 | 20 | * |
| @@ -19,9 +19,9 @@ | ||
| 19 | 19 | * The SEMrush keyphrase URL. |
| 20 | 20 | * |
| 21 | 21 | * @var string |
| 22 | 22 | */ |
| 23 | - const KEYPHRASES_URL = 'https://oauth.semrush.com/api/v1/keywords/phrase_fullsearch'; | |
| 23 | + public const KEYPHRASES_URL = 'https://oauth.semrush.com/api/v1/keywords/phrase_fullsearch'; | |
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * The SEMrush_Client instance. |
| 27 | 27 | * |
| @@ -50,9 +50,9 @@ | ||
| 50 | 50 | try { |
| 51 | 51 | $transient_key = \sprintf( static::TRANSIENT_CACHE_KEY, $keyphrase, $database ); |
| 52 | 52 | $transient = \get_transient( $transient_key ); |
| 53 | 53 | |
| 54 | - if ( $transient !== false ) { | |
| 54 | + if ( $transient !== false && isset( $transient['data']['columnNames'] ) && \count( $transient['data']['columnNames'] ) === 5 ) { | |
| 55 | 55 | return $this->to_result_object( $transient ); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | $options = [ |
| @@ -58,9 +58,9 @@ | ||
| 58 | 58 | $options = [ |
| 59 | 59 | 'params' => [ |
| 60 | 60 | 'phrase' => $keyphrase, |
| 61 | 61 | 'database' => $database, |
| 62 | - 'export_columns' => 'Ph,Nq,Td', | |
| 62 | + 'export_columns' => 'Ph,Nq,Td,In,Kd', | |
| 63 | 63 | 'display_limit' => 10, |
| 64 | 64 | 'display_offset' => 0, |
| 65 | 65 | 'display_sort' => 'nq_desc', |
| 66 | 66 | 'display_filter' => '%2B|Nq|Lt|1000', |
| @@ -93,5 +93,4 @@ | ||
| 93 | 93 | 'status' => $result['status'], |
| 94 | 94 | ]; |
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | - | |