Plugin Directory

Changeset 3442843


Ignore:
Timestamp:
01/19/2026 10:51:04 PM (2 months ago)
Author:
rankauthority
Message:

Update: post meta data / yoast handling

Location:
rank-authority
Files:
6 added
2 edited

Legend:

Unmodified
Added
Removed
  • rank-authority/trunk/rank-authority.php

    r3439796 r3442843  
    44 * Plugin URI: https://rankauthority.com/plugins/rankauthority
    55 * Description: Secure API connector to publish posts / overwrite posts from the RA Dashboard to WordPress.
    6  * Version: 1.0.10
     6 * Version: 1.0.11
    77 * Author: Rank Authority
    88 * Author URI: https://rankauthority.com
     
    673673        $website_id = get_option($this->option_website_id);
    674674        $token = get_option($this->option_token);
    675         $plugin_version = get_file_data(__FILE__, array('Version' => 'Version'), false)['Version'] ?? '1.0.10';
     675        $plugin_version = get_file_data(__FILE__, array('Version' => 'Version'), false)['Version'] ?? '1.0.11';
    676676
    677677        ?>
     
    11091109        }
    11101110
     1111        // Set meta description if provided
     1112        if (!empty($params['meta_description'])) {
     1113            $meta_description = sanitize_text_field($params['meta_description']);
     1114           
     1115            // Support multiple SEO plugins
     1116            // Yoast SEO
     1117            update_post_meta($post_id, '_yoast_wpseo_metadesc', $meta_description);
     1118           
     1119            // Rank Math
     1120            update_post_meta($post_id, 'rank_math_description', $meta_description);
     1121           
     1122            // All in One SEO
     1123            update_post_meta($post_id, '_aioseo_description', $meta_description);
     1124           
     1125            // Generic meta description (for custom themes/plugins)
     1126            update_post_meta($post_id, '_meta_description', $meta_description);
     1127        }
     1128
     1129        // Set focus keyphrase (keyword) if provided - Yoast SEO
     1130        if (!empty($params['yoast_keyword'])) {
     1131            $focus_keyword = sanitize_text_field($params['yoast_keyword']);
     1132            update_post_meta($post_id, '_yoast_wpseo_focuskw', $focus_keyword);
     1133        }
     1134
    11111135        $permalink = get_permalink($post_id);
    11121136
     
    11901214        if (!empty($params['tags']) && is_array($params['tags'])) {
    11911215            wp_set_post_tags($updated_id, $params['tags']);
     1216        }
     1217
     1218        // Update meta description if provided
     1219        if (isset($params['meta_description'])) {
     1220            if (!empty($params['meta_description'])) {
     1221                $meta_description = sanitize_text_field($params['meta_description']);
     1222               
     1223                // Support multiple SEO plugins
     1224                // Yoast SEO
     1225                update_post_meta($updated_id, '_yoast_wpseo_metadesc', $meta_description);
     1226               
     1227                // Rank Math
     1228                update_post_meta($updated_id, 'rank_math_description', $meta_description);
     1229               
     1230                // All in One SEO
     1231                update_post_meta($updated_id, '_aioseo_description', $meta_description);
     1232               
     1233                // Generic meta description (for custom themes/plugins)
     1234                update_post_meta($updated_id, '_meta_description', $meta_description);
     1235            } else {
     1236                // If description is empty, delete meta descriptions
     1237                delete_post_meta($updated_id, '_yoast_wpseo_metadesc');
     1238                delete_post_meta($updated_id, 'rank_math_description');
     1239                delete_post_meta($updated_id, '_aioseo_description');
     1240                delete_post_meta($updated_id, '_meta_description');
     1241            }
     1242        }
     1243
     1244        // Update focus keyphrase (keyword) if provided - Yoast SEO
     1245        if (isset($params['yoast_keyword'])) {
     1246            if (!empty($params['yoast_keyword'])) {
     1247                $focus_keyword = sanitize_text_field($params['yoast_keyword']);
     1248                update_post_meta($updated_id, '_yoast_wpseo_focuskw', $focus_keyword);
     1249            } else {
     1250                // If keyword is empty, delete focus keyphrase
     1251                delete_post_meta($updated_id, '_yoast_wpseo_focuskw');
     1252            }
    11921253        }
    11931254
  • rank-authority/trunk/readme.txt

    r3439796 r3442843  
    55Tested up to: 6.9
    66Requires PHP: 7.4
    7 Stable tag: 1.0.10
     7Stable tag: 1.0.11
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    136136== Changelog ==
    137137
     138= 1.0.11 =
     139* Added support for meta_description parameter in publish and update post endpoints
     140* Added support for keyword parameter to set Yoast SEO focus keyphrase
     141* Enhanced SEO plugin compatibility (Yoast SEO, Rank Math, All in One SEO)
     142* Improved API functionality with SEO metadata support
     143
    138144= 1.0.10 =
    139145* Moved version information from header to footer above "Powered by" text
     
    201207== Upgrade Notice ==
    202208
     209= 1.0.11 =
     210Added SEO metadata support - now you can set meta descriptions and focus keywords via API.
     211
    203212= 1.0.10 =
    204213Improved UI layout - version information now displayed in footer for better visual hierarchy.
Note: See TracChangeset for help on using the changeset viewer.