WordPress基于PHP构建。所以WP REST API插件也是用PHP编写的。 正如你所说的,你使用WordPress REST api v2。 让我从共享代码的位置开始:WordPress REST api v2
正如你可以看到这个WP REST API不包括任何SEO的东西。
现在你还安装了'all-in-one-seo-pack'插件。 free version不包含内置API。你可以升级到Pro Version这个'all-in-one-seo-pack',它有一个内置的API。
或者你可以自己扩展WordPress REST api v2通过添加额外的端点。然后自己编写PHP代码,通过REST API管理你的SEO插件。
它并不那么困难 - >正如Raunak Gupta已经告诉你的那样:这些都是'一体式seo包装'中使用的领域。用其他端点扩展REST API来配置它们。然后从C#代码中调用您的端点。
<wpml-config>
<custom-fields>
<custom-field action="translate">_aioseop_title</custom-field>
<custom-field action="translate">_aioseop_description</custom-field>
<custom-field action="translate">_aioseop_keywords</custom-field>
</custom-fields>
<admin-texts>
<key name="aioseop_options">
<key name="aiosp_home_title" />
<key name="aiosp_home_description" />
<key name="aiosp_home_keywords" />
<key name="aiosp_post_title_format" />
<key name="aiosp_page_title_format" />
<key name="aiosp_category_title_format" />
<key name="aiosp_archive_title_format" />
<key name="aiosp_tag_title_format" />
<key name="aiosp_search_title_format" />
<key name="aiosp_description_format" />
<key name="aiosp_404_title_format" />
<key name="aiosp_paged_format" />
</key>
</admin-texts>
</wpml-config>
看看免费版本的代码。使用此代码可以在编写自己的代码时获得灵感。 WordPress希望你扩展功能。为社区做贡献!
if (!function_exists('aioseop_ajax_save_meta')) {
function aioseop_ajax_save_meta() {
if (!empty($_POST['_inline_edit']) && ($_POST['_inline_edit'] != 'undefined'))
check_ajax_referer('inlineeditnonce', '_inline_edit');
$post_id = intval($_POST['post_id']);
$new_meta = strip_tags($_POST['new_meta']);
$target = $_POST['target_meta'];
check_ajax_referer('aioseop_meta_' . $target . '_' . $post_id, '_nonce');
$result = '';
if (in_array($target, Array('title', 'description', 'keywords')) && current_user_can('edit_post', $post_id)) {
update_post_meta($post_id, '_aioseop_' . $target, esc_attr($new_meta));
$result = get_post_meta($post_id, '_aioseop_' . $target, true);
} else {
die();
}
if($result != ''):
$label = "<label id='aioseop_label_{$target}_{$post_id}'><span style='width: 20px;display: inline-block;'></span>" . $result . '</label>';
else:
$label = "<label id='aioseop_label_{$target}_{$post_id}'></label><span style='width: 20px;display: inline-block;'></span><strong><i>" . __('No', 'all-in-one-seo-pack') . ' ' . $target . '</i></strong>';
endif;
$nonce = wp_create_nonce("aioseop_meta_{$target}_{$post_id}");
$output = '<a id="' . $target . 'editlink' . $post_id . '" class="aioseop_edit_link" href="javascript:void(0);"'
. 'onclick=\'aioseop_ajax_edit_meta_form(' . $post_id . ', "' . $target . '", "' . $nonce . '");return false;\' title="' . __('Edit') . '">'
. '<img class="aioseop_edit_button" id="aioseop_edit_id" src="' . AIOSEOP_PLUGIN_IMAGES_URL . '/cog_edit.png" /></a> ' . $label;
die("jQuery('div#aioseop_" . $target . "_" . $post_id . "').fadeOut('fast', function() { var my_label = " . json_encode($output) . ";
jQuery('div#aioseop_" . $target . "_" . $post_id . "').html(my_label).fadeIn('fast');
});");
}
}
我看到了什么,你的代码是呈三角[发布WordPress的使用WP REST API C#](http://stackoverflow.com/questions/38458678/post-on-wordpress-using-wp-rest- api-c-sharp)的问题,但有人提出了任何解决方案。我不是C#的人,但如果你需要任何帮助,我可以帮助你。和_All In One SEO Pack_使用以下post_meta来保存元标签的元标签:'_aioseop_title',元描述的'_aioseop_description'和Meta关键字的'_aioseop_keywords'。希望这可以帮助你。 –
@RaunakGupta这是类似的,因为这是我的问题(来自另一个帐户)...谢谢:) –