1. Prevent empty checkbox in Syndicate To meta box
Somehow (didn’t check why/how exactly, perhaps because of how defaults work on the settings page) Post_Syndication:register would register an empty provider that would cause an extra checkbox with no label to appear in the Syndicate To meta box within the WordPress editor.
I added a check that prevents any provider from being registered unless it has at least a UID value – which also solves the glitch with the extra checkbox.
2. Moved button, enhanced markup in Syndication Links meta box
There wasn’t anything functionally wrong, so this one doesn’t ‘fix’ anything but optics. I enhanced markup a little by wrapping all inputs in a real list (<ul>); this adds a little air between list items without any additional CSS.
I also placed the Add button below the list instead of above. While I think I can imagine what made you place it above in the first place, I found it more intuitive below, plus it acts nicely: the button stays in place when you click it while the list moves upwards with every new line added to it. So I thought this could be a nice visual enhancement.
Finally, I removed the id attribute from new inputs added via jQuery because ids got duplicated (which can be an a11y issue) and they didn’t seem functionally necessary as long as name attributes stay intact.
I tested this commit in both, the Classic Editor and Block Editor (which is why I added event.preventDefault() because without it and the Classic Editor active, the page would reload when I clicked the button).
1. Prevent empty checkbox in Syndicate To meta box
Somehow (didn’t check why/how exactly, perhaps because of how defaults work on the settings page)
Post_Syndication:register
would register an empty provider that would cause an extra checkbox with no label to appear in the Syndicate To meta box within the WordPress editor.I added a check that prevents any provider from being registered unless it has at least a UID value – which also solves the glitch with the extra checkbox.
2. Moved button, enhanced markup in Syndication Links meta box
There wasn’t anything functionally wrong, so this one doesn’t ‘fix’ anything but optics. I enhanced markup a little by wrapping all inputs in a real list (
<ul>
); this adds a little air between list items without any additional CSS.I also placed the Add button below the list instead of above. While I think I can imagine what made you place it above in the first place, I found it more intuitive below, plus it acts nicely: the button stays in place when you click it while the list moves upwards with every new line added to it. So I thought this could be a nice visual enhancement.
Finally, I removed the
id
attribute from new inputs added via jQuery because ids got duplicated (which can be an a11y issue) and they didn’t seem functionally necessary as long asname
attributes stay intact.I tested this commit in both, the Classic Editor and Block Editor (which is why I added
event.preventDefault()
because without it and the Classic Editor active, the page would reload when I clicked the button).