Support » Fixing WordPress » Does this php include look ok?

  • Resolved andym33


    I would like to add a dashboard widget and need to include/ require (whatever is better) a php file from my root. I combined a couple of things together that I found on different websites and it works, but I don’t know php very well so just checking to see if there is a better way to write it especially if it causes problems with security/performance.

    function andym_dashboard_widget_1() {
                     'andym_dashboard_app_widget',         // Widget slug.
                     'Test Widget',                               // Title.
                     'andym_dashboard_widget_1_function'   // Display function.
    add_action( 'wp_dashboard_setup', 'andym_dashboard_widget_1' );
    function andym_dashboard_widget_1_function() {
     $path = $_SERVER['DOCUMENT_ROOT'];
       $path .= "/myfolder/myfile.php";

    Thanks in advance

  • The topic ‘Does this php include look ok?’ is closed to new replies.