how to write php require_once `<?php bloginfo(‘url’); ?>/database.php`

In wordpress <?php bloginfo('url'); ?> is the main page’s url, then, how to write a require_once include <?php bloginfo('url'); ?>
Something I write like this is not worked :{

<?php require_once ( "".bloginfo('url')."/database.php"); ?>

Related posts

Leave a Reply

2 comments

  1. The bloginfo function will echo the data, not return it. As such, you need to use the get_bloginfo function, as this simply returns the data.

    For example:

    <?php require_once (get_bloginfo('url') . '/database.php'); ?>
    

    However, it should be noted that if you’re trying to include a local file you should simply use the ABSPATH define, as this will return the base install directory, which is what I’m guessing you’re attempting to do.

    i.e.: If “database.php” is located in the root WordPress directory, then…

    <?php require_once (ABSPATH . '/database.php'); ?>
    

    should work.