• I am developing a wordpress plugin that connects to external database,
    fetch data, and displays it on metabox below page/post editor.
    I used following code:

    /** MySQL hostname */
    define(‘EXT_DB_HOST’, ‘removed’);

    /** MySQL database name */
    define(‘EXT_DB_NAME’, ‘removed’);

    <?php
    /** MySQL database username */
    define(‘EXT_DB_USER’, ‘removed’);

    /** MySQL database password */
    define(‘EXT_DB_PASSWORD’, ”);

    /** MySql table prefix */
    define(‘TABLE_PREFIX’,’removed’);
    $new_db=”;
    $new_wpdb=new WPDB(EXT_DB_USER, EXT_DB_PASSWORD, EXT_DB_NAME, EXT_DB_HOST);
    ?>
    saved this file as wp-db-config.php

    included this file in constructor of main plugin class and
    I used ajax for fetching data.
    The data is shown in metabax below editor in both posts and page.
    I got success in adding, getting, deleting, updating data.

    The main problem arise is that I cant update or create new post and page.
    I googled this problem but I didnt get solution. Please help me out of this problem

Viewing 2 replies - 1 through 2 (of 2 total)
  • Most likely the hook you are using. It’s probably running too early.. which is preventing the rest of the normal WP functionality to complete.

    Use pastebin.com, and show me the code you are working with. Specifically, the code of how you are connecting to this database and displaying it’s contents.

    Thread Starter mppatil211

    (@mppatil211)

    Check this link
    https://pastebin.com/8XEA7vf1
    for code

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘External database connection’ is closed to new replies.