If I understood you correctly, you want to prevent users from selecting a radio option, which have been already selected on another post, when the user is adding a new post, right?
I think you need to first check if the user is on the “add new” page in your metabox. You can do that with the global $pagenow
variable. That will give you post-new.php
when you’re on the “add new” page.
(Side note: You could also wrap the check in a custom function like seen here, How to determine whether we are in add New page/post/CPT or in edit page/post/CPT in wordpress admin?)
Then do a conditional check to make sure it is the “add new” page. If so get all the values that have already been selected on other posts. This is somewhat unfamiliar territory for me, but I found a promising old thread on the matter – How to get a meta value from all post
I think the custom get_meta_values
function shared on the old thread should do the trick for you. It might need some tweaking, but test it and see how it works.
And third, when you have the array of previously selected values, you can use it to mark matching options as selected / disabled.
Hopefully I didn’t miss the mark too badly and answered you’re question. I’m sorry I don’t have any code of my own to share with you. This is the idea and concept that popped into my mind after reading your question.