fix(frontend): route post editing to frontend submit

This commit is contained in:
2026-08-13 19:48:22 +08:00
parent 0e03a28e15
commit 51d2ab3aa7
+15 -1
View File
@@ -111,7 +111,21 @@ if (!function_exists('aksrt_get_single_meta_box')) :
$meta = function_exists('aksrt_get_posts_meta_items_html') ? aksrt_get_posts_meta_items_html($post_id) : '';
$more = '';
$edit_link = '';
if (current_user_can('manage_options')) {
// Site administrators retain the native editor for full post maintenance.
$edit_link = get_edit_post_link($post_id);
} elseif (class_exists('\AKSRT\Core\FrontSubmit') && function_exists('aksrt_find_template_page')) {
$front_submit = \AKSRT\Core\FrontSubmit::get_instance();
$submit_page = aksrt_find_template_page('templates/pages/page-submit.php');
if ($submit_page instanceof WP_Post && $front_submit->can_edit_post($post_id)) {
// Do not fall back to /wp-admin or a guessed submit URL. A normal
// author sees this action only when the configured frontend editor exists.
$edit_link = function_exists('aksrt_get_new_post_url')
? aksrt_get_new_post_url($post_id)
: '';
}
}
$permalink = get_permalink($post_id);
$login_url = function_exists('aksrt_get_login_url') ? aksrt_get_login_url() : wp_login_url($permalink ?: home_url('/'));
@@ -119,7 +133,7 @@ if (!function_exists('aksrt_get_single_meta_box')) :
$more .= '<button type="button" class="but cir post-drop-meta__toggle" aria-haspopup="true" aria-expanded="false" aria-label="' . esc_attr__('更多', 'aksrt') . '">';
$more .= '<i class="fa fa-ellipsis-h" aria-hidden="true"></i></button>';
$more .= '<div class="post-drop-meta__menu" aria-hidden="true">';
if ($edit_link && current_user_can('edit_post', $post_id)) {
if ($edit_link) {
$more .= '<a href="' . esc_url($edit_link) . '" class="post-drop-meta__item"><i class="fa fa-edit" aria-hidden="true"></i><span>' . esc_html__('编辑文章', 'aksrt') . '</span></a>';
}
$more .= '<button type="button" class="post-drop-meta__item" data-share-copy data-share-url="' . esc_url((string) $permalink) . '"><i class="fa fa-link" aria-hidden="true"></i><span>' . esc_html__('复制链接', 'aksrt') . '</span></button>';