WordPress.org

Ready to get started?Download WordPress

Forums

Add a tinyMCE plugin + WordPress functionality (4 posts)

  1. credo61
    Member
    Posted 1 year ago #

    Hi,

    I've added a button to tinyMCE which loads a php file into the iframe.
    Actually it's a shortcode manager and I need to use some wordpress functionality such as translation functions or getting categories list or ...

    To do this, I need to include wp-load.php and every thing works great with it. But I read on the forums that including wp-load.php is not a good practice at all!

    So what's the best solution for my problem? Is there any way to load tinyMCE plugin without loading it within iframe or is there any other way to use wordpress functions in a file which is loaded into iframes or popups?

    Thanks.

  2. bcworkz
    Member
    Posted 1 year ago #

    I don't know much about TinyMCE, but anything done in an iframe could be done directly on a page. For example, the wp_editor() function builds containers for the tabs, buttons, content and the rest is handled with javascript, no iframes involved.

    Either way, it does not help you access WP functions without wp-load.php being included or required somewhere. You could use AJAX or load your page as a template to avoid including wp-load.php, but it's being included somewhere none the less, just not by you.

    AFAIK, the main issue with including wp-load.php is it's difficult reliably know where it is located on any random installation. If this is for your own site and not for distribution, I personally would go ahead and leave things as they are, but do use something like require_once() to ensure it is not reloaded unnecessarily.

  3. credo61
    Member
    Posted 1 year ago #

    I've used admin-ajax.php to load my content into tinyMCE plugin iframe without including wp-load.php.

    thanks

  4. Ram Ratan Maurya
    Member
    Posted 1 year ago #

    Hey credo61,
    I've been working on something too similar but for me popup just won't work unless I load wp-load.php. Could you help me with what workaround did you get for this problem?

Topic Closed

This topic has been closed to new replies.

About this Topic