Yes, I see your point! (And thanks for explaining!)
Personally I would not be in favour of a JavaScript solution like you mentioned above – that would add extra overhead (more files to load etc) to get that to work, and my Admin pages already take too long to load as it is! ??
A couple of other ideas that come to mind, as I think more about this:
1) Although the title of a content block can easily be changed, I think it’s very unlikely that the slug will change – why would it need to be changed? So if the shortcode was based on the slug, rather than the title, I think that would be a safe compromise.
You could still make the shortcode work from the ID too – so users who prefer to stick with the ID method can still do so, and then everyone is happy. You could also add some kind of warning or note somewhere, that changing the slug of the content block will mean that the user needs to update their shortcodes.
So the user can either have [id=”12345″] or else [slug=”my-content-block”] in the shortcode – either way will work, and they can choose.
Further to this idea: you could create a basic Settings sub-page for Content Blocks (in the side menu), and on this page you can let the user (Admin) choose which method they want for the shortcodes – ID or slug. Directly underneath this setting, you can have a big, clear warning text about the consequences of using the slug method (ie. that changing the slug itself means you need to change the shortcode too, therefore please be very careful about changing the slugs!)
2) Yet another idea: allow the shortcodes to contain both the ID and the title. Eg:
[content_block id=”12345″ description=”My Awesome Block of Content”]
In this case, only the ID field actually matters – that field is what determines which content block to load. The description field is there only as an optional description, and it doesn’t matter if it changes or even if it is removed. So the user can put whatever they want into the description field, as long as the ID field is correct – and your plugin could take the content block’s current title to use initially for the description, but the user is free to change this later in the shortcode if they want.
What do you think? Personally I prefer the first idea above. ?? But anyway, I hope this is helpful in getting some ideas flowing.