forked from Solo-Web-Works/Projects-Portfolio
fix: clear legacy _projects_portfolio_github_url on provider switch / empty repo URL
This commit is contained in:
+10
-1
@@ -114,7 +114,16 @@ function projects_portfolio_save_meta_box( $post_id ) {
|
||||
// Maintain the legacy key for backward-compat reads (only when this is a GitHub project).
|
||||
$provider_now = get_post_meta( $post_id, '_projects_portfolio_provider', true );
|
||||
if ( 'github' === $provider_now ) {
|
||||
update_post_meta( $post_id, '_projects_portfolio_github_url', $repo_url );
|
||||
if ( '' === $repo_url ) {
|
||||
// Clearing the field on a GitHub project should clear the legacy key too.
|
||||
delete_post_meta( $post_id, '_projects_portfolio_github_url' );
|
||||
} else {
|
||||
update_post_meta( $post_id, '_projects_portfolio_github_url', $repo_url );
|
||||
}
|
||||
} else {
|
||||
// Provider is gitea (or any non-github): ensure no stale GitHub URL can
|
||||
// resurrect via the legacy fallback chain.
|
||||
delete_post_meta( $post_id, '_projects_portfolio_github_url' );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user