Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong URL from plugin #129

Open
zagreusinoz opened this issue Feb 27, 2018 · 2 comments
Open

Wrong URL from plugin #129

zagreusinoz opened this issue Feb 27, 2018 · 2 comments

Comments

@zagreusinoz
Copy link

zagreusinoz commented Feb 27, 2018

Overview

I'm mounting plugins that I'm developing as the documentation says and in my plugin I'm trying to get the url of some scripts like this:
$path = dirname(plugin_dir_url( __FILE__ )) . '/scripts/js/script.js';

However this returns the URL:
http://localhost:8080/app/wp-content/plugins/customer-manager/scripts/js/script.js?ver=5.6.8

whereas the actual URL should be:
http://localhost:8080/wp-content/plugins/customer-manager/scripts/js/script.js?ver=5.6.8

without the app directory.

Any help would be much appreciated. Thanks!

docker-compose.yml

version: '3'
services:
  wordpress:
    image: visiblevc/wordpress:0.17.0-php7.1
    ports:
      - 8080:80
      - 443:443
    volumes:
      - ./data:/data
      - ./themes/customer-theme:/app/wp-content/themes/customer-theme
      - ./plugins/customer:/app/wp-content/plugins/customer
      - ./plugins/customer-manager:/app/wp-content/plugins/customer-manager
      - ./../config/php.ini:/usr/local/etc/php/conf.d/php.ini
    environment:
      WP_VERSION: latest
      DB_NAME: wordpress
      DB_PASS: root
      WP_DEBUG: 'true'
      WP_DEBUG_DISPLAY: 'true'
      WP_DEBUG_LOG: 'true'
      PLUGINS: >-
        bulk-delete
      THEMES: >-
        bootstrap-basic4

  db:
    image: mariadb:10 # or mysql:5.7
    volumes:
      - data:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: root

  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    environment:
      MYSQL_ROOT_PASSWORD: root
    ports:
      - 22222:80

volumes:
  data:
@dsifford
Copy link
Collaborator

@zagreusinoz I think the issue is with your function, not the docker setup.

You should be doing just plugin_dir_url(__FILE__) instead of wrapping that in a dirname() call.

@zagreusinoz
Copy link
Author

zagreusinoz commented Mar 10, 2018

All that dirname should be doing is to go up a level in the path though I thought. It shouldn't add anything additional to the path itself.

I just double checked it and that is indeed what it does. Even without dirname the extraneous /app/ is part of the path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants