Title: wp_content_dir creating error
Last modified: December 11, 2023

---

# wp_content_dir creating error

 *  Resolved [Kenneth Ballard](https://wordpress.org/support/users/brandishwar/)
 * (@brandishwar)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/wp_content_dir-creating-error/)
 * WordPress: 6.4.2
   PHP: 8.2 FPM (via Docker)Visualizer plugin: 3.10.4
 * I’m in the middle of migrating my WordPress site to Docker, and I’ll be using
   nginx for this. (Existing site is using Apache2.) And I was getting a rather 
   interesting error:
 *     ```wp-block-code
       NOTICE: PHP message: PHP Fatal error:  Uncaught TypeError: ftp_nlist(): Argument #1 ($ftp) must be of type FTP\Connection, null given in /usr/share/nginx/wordpress/wp-admin/includes/class-wp-filesystem-ftpext.php:438
       ```
   
 * Here’s the stacktrace:
 *     ```wp-block-code
       Stack trace:
       #0 /usr/share/nginx/wordpress/wp-admin/includes/class-wp-filesystem-ftpext.php(438): ftp_nlist()
       #1 /usr/share/nginx/wordpress/wp-admin/includes/class-wp-filesystem-base.php(231): WP_Filesystem_FTPext->exists()
       #2 /usr/share/nginx/wordpress/wp-admin/includes/class-wp-filesystem-base.php(79): WP_Filesystem_Base->find_folder()
       #3 /usr/share/nginx/wordpress/wp-content/plugins/visualizer/classes/Visualizer/Module.php(532): WP_Filesystem_Base->wp_content_dir()
       #4 /usr/share/nginx/wordpress/wp-content/plugins/visualizer/classes/Visualizer/Module/Frontend.php(274): Visualizer_Module->get_user_customization_js()
       #5 /usr/share/nginx/wordpress/wp-includes/class-wp-hook.php(324): Visualizer_Module_Frontend->enqueueScripts()
       #6 /usr/share/nginx/wordpress/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
       #7 /usr/share/nginx/wordpress/wp-includes/plugin.php(517): WP_Hook->do_action()
       #8 /usr/share/nginx/wordpress/wp-includes/script-loader.php(2262): do_action()
       #9 /usr/share/nginx/wordpress/wp-includes/class-wp-hook.php(324): wp_enqueue_scripts()
       #10 /usr/share/nginx/wordpress/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
       #11 /usr/share/nginx/wordpress/wp-includes/plugin.php(517): WP_Hook->do_action()
       #12 /usr/share/nginx/wordpress/wp-includes/general-template.php(3052): do_action()
       #13 /usr/share/nginx/wordpress/wp-content/themes/graphy/header.php(15): wp_head()
       #14 /usr/share/nginx/wordpress/wp-includes/template.php(790): require_once('/usr/share/nginx/wordpress/wp-content/themes/graphy/header.php')
       #15 /usr/share/nginx/wordpress/wp-includes/template.php(725): load_template()
       #16 /usr/share/nginx/wordpress/wp-includes/general-template.php(48): locate_template()
       #17 /usr/share/nginx/wordpress/wp-content/themes/graphy/home.php(10): get_header()
       #18 /usr/share/nginx/wordpress/wp-includes/template-loader.php(106): include('/usr/share/nginx/wordpress/wp-content/themes/graphy/home.php')
       #19 /usr/share/nginx/wordpress/wp-blog-header.php(19): require_once('/usr/share/nginx/wordpress/wp-includes/template-loader.php')
       #20 /usr/share/nginx/wordpress/index.php(17): require('/usr/share/nginx/wordpress/wp-blog-header.php')
       #21 {main}
         thrown in /usr/share/nginx/wordpress/wp-admin/includes/class-wp-filesystem-ftpext.php on line 438
       ```
   
 * In going through the plugin’s code with the stack trace above, I believe the 
   issue is your call to this method: `WP_Filesystem_Base::wp_content_dir()`. This
   method is called on lines 532 and 533 of `classes/Visualizer/Module.php`. Changing
   these lines to use `WP_CONTENT_DIR` alleviated the error.
 * And in searching the code to the other plugins I have installed, it appears yours
   is the only one (of my set, at least) using the `wp_content_dir()` method to 
   get the content directory path. You should change that to use the `WP_CONTENT_DIR`
   variable directly instead since there appears to be an issue with the wp_content_dir
   method on some setups. I am not seeing any adverse side-effects with the plugin
   with that change.

Viewing 1 replies (of 1 total)

 *  Plugin Support [irinelenache](https://wordpress.org/support/users/irinelenache/)
 * (@irinelenache)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/wp_content_dir-creating-error/#post-17271339)
 * Hello [@brandishwar](https://wordpress.org/support/users/brandishwar/),
 * We appreciate your cooperation in reporting the issue you’re encountering. We
   are sorry for the inconvenience, and we have confirmed the problem. A bug report
   has been created and forwarded to our product development team for review.
 * What happens next?
 * Our product team will evaluate the impact of this issue compared to other open
   bugs and upcoming features, and assign a priority level to the bug report. Our
   developers prioritize the highest-priority issues first, so we cannot provide
   a specific timeline for resolution at this time.
 * Best regards,
 * Irinel

Viewing 1 replies (of 1 total)

The topic ‘wp_content_dir creating error’ is closed to new replies.

 * ![](https://ps.w.org/visualizer/assets/icon-256x256.gif?rev=3084574)
 * [Visualizer: Tables and Charts Manager for WordPress](https://wordpress.org/plugins/visualizer/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/visualizer/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/visualizer/)
 * [Active Topics](https://wordpress.org/support/plugin/visualizer/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/visualizer/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/visualizer/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [irinelenache](https://wordpress.org/support/users/irinelenache/)
 * Last activity: [2 years, 5 months ago](https://wordpress.org/support/topic/wp_content_dir-creating-error/#post-17271339)
 * Status: resolved