Mind Elixir × Custom WordPress Plugin: Added Features for Saving, Switching, and Deleting Multiple Mind Maps

Previously, I built a custom WordPress plugin that allows users to create, switch, and delete multiple mind maps directly within the WordPress dashboard (I tried making a plugin to jot down post ideas using mind maps in the WordPress admin screen). This time, I’ve added a multiple map management feature. It’s now a fully-featured version where you can load topics via a dropdown, save JSON data to wp_options with a prefix, and even include a delete button, a confirmation dialog, and a “New Map" button.

目次

Final Specifications

  1. Display mind map topics in the dropdown

  2. Save to wp_options with the prefix mind_elixir_map_data_

  3. Add a delete button

  4. Show a confirmation popup when the delete button is clicked

  5. Add a button to create new maps

Mind map editor multiple mind map management


Implementation Highlights

Managing Topics via Dropdown

  • Run SELECT option_name, option_value … WHERE option_name LIKE 'mind_elixir_map_data_%' on the server side and decode the JSON

  • Extract the root node’s nodeData.topic and set it as the display text for <option>

  • Fetch the list via AJAX on the JavaScript side and dynamically re-render using $('#mea-map-selector').empty().append(...)

Registering Options with a Prefix Upon Saving

  • When the save button is clicked, stringify the JSON obtained from mind.getData()

  • Generate option_name using the prefix plus the current date and time (YmdHis), and persist it via update_option()

Delete Button and Confirmation Dialog

  • Trigger a confirmation popup using window.confirm() when the button is pressed

  • If OK, execute delete_option() via AJAX and re-render the list upon success

New Map Addition Button

  • Generate data from MindElixir.new() with a fixed topic of “New Mind Map"

  • Add a new option to the dropdown, making it immediately ready for loading and saving


Conclusion

With this plugin, I implemented an administrative interface that makes it easy to save, switch, and delete mind maps using WordPress’s wp_options table.

  • Dropdown: List items by topic

  • Save: Automatically generate option names using prefix + timestamp

  • Delete: Safely remove items with a confirmation dialog

  • New Addition: Generate a blank map with a single button

The GitHub repository is also publicly available, so please give it a try!

https://github.com/bomura/wp-mind-elixir-admin