How to add a simple design in classic editor plugin creating post page through another Wp plugin

You would need to do the following:

  • add a metabox with a text input and a button ( give them unique IDs )
  • enqueue a javascript file
  • in your javascript file, look for the input and button by the unique ID you gave them
    • when the button is pressed, look up the inputs value, and make your AJAX request, jQuery should be enough to do this if you’re unsure how
    • if it’s successful, replace the content in the TinyMCE field using the standard javascript APIs
  • you will also need to implement an AJAX handler, either as a REST API endpoint, or via the old admin-ajax.php API. This is what makes the request to your API ( also why use curl when WordPress has a more portable wrapper around it with wp_remote_get/wp_remote_post and the WP_HTTP API )

There are quite a few parts here, each of which are covered already on the official dev docs and in questions other people have already asked and answered on the site. If you are unsure how to do any of the steps, search this stack or the official WP documentation for that smaller step.

Important notes:

  • never make direct browser requests to PHP files in your plugin or theme
  • never modify plugins you didn’t write yourself
  • you don’t need to modify the classic editor plugin to add metaboxes, any plugin can do that
  • you don’t need the classic editor plugin to make custom post types not use the block editor
  • you could replace all the blocks in the block editors content in a 1 liner, using the classic editor does not make this task easier ( and the block editor will show a custom metabox in the sidebar anyway )