Support

Account

Home Forums Bug Reports Use of plugin_dir_url() in 5.x precludes loading from theme dir

Unread

Use of plugin_dir_url() in 5.x precludes loading from theme dir

  • I maintain an ACF add-on and recently had a bug report from a user trying to load the add-on from his theme directory. None of the CSS/JS assets were loading correctly.

    Looking at the add-on boilerplate that I used to build my add-on, it uses plugin_dir_url() to get the asset public URL. However when this function is used outside of the plugin directory it returns unexpected results. It returns the full PHP (non web friendly) path.

    In 4.x these asset urls were built manually with a helper function. In the meantime I have bundled that helper function with my plugin to fix this issue.

    More details on the issue can be found here: https://wordpress.org/support/topic/load-plugin-in-my-theme?replies=9

Viewing 1 post (of 1 total)

The topic ‘Use of plugin_dir_url() in 5.x precludes loading from theme dir’ is closed to new replies.