When writing a plugin, I define a few constants including the path to the plugin’s root folder, and its “name” as used in some admin hooks:
define('WPSE_102681_PLUGIN_NAME', basename(dirname(__FILE__)) . "https://wordpress.stackexchange.com/" . basename(__FILE__));
I’ve found that plugins_url()
happily takes that constant, which is useful when referencing files from subfolders of the plugin, like so:
echo plugins_url('images/information.png', WPSE_102681_PLUGIN_NAME);
Maybe it’ll fix your problem.
Related Posts:
- Is it safe to pass directory path to plugins_url()?
- Are there functions for file paths, instead of just urls
- Insert Current URL into MailTo link in wordpress
- How to open a “-” dashed filename using terminal?
- How do I deal with a filename that starts with the hyphen (-) character?
- Chmod 777 to a folder and all contents [duplicate]
- Bash: No such file or directory?
- Sleep for milliseconds
- How can I update NodeJS and NPM to the next versions?
- Cannot connect to the Docker daemon at unix:/var/run/docker.sock. Is the docker daemon running?
- Sleep for milliseconds
- Confused about stdin, stdout and stderr?
- Visual list of all installed fonts with respective pangram phrase?
- How do I copy folder with files to another folder in Unix/Linux? [closed]
- What’s a .sh file?
- Amazon Linux: apt-get: command not found
- How to set the environmental variable LD_LIBRARY_PATH in linux
- Amazon Linux: apt-get: command not found
- What’s a .sh file?
- How to create a file in Linux from terminal window? [closed]
- ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)
- Why does ENOENT mean “No such file or directory”?
- sudo: npm: command not found
- How can I symlink a file in Linux? [closed]
- How to fix ‘sudo: no tty present and no askpass program specified’ error?
- HTTP POST and GET using cURL in Linux [duplicate]
- Kill detached screen session [closed]
- ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)
- Undefined reference to pthread_create in Linux
- what is the difference between uint16_t and unsigned short int incase of 64 bit processor?
- How do I grep recursively?
- ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)
- How do I grep recursively?
- Openssl : error “self signed certificate in certificate chain”
- Why do you need to put #!/bin/bash at the beginning of a script file?
- How to get the url of the current svn repo?
- What does pss mean in /proc/pid/smaps
- apt-get error: Sub-process /usr/bin/dpkg returned an error code (1)
- What is a clearfix?
- What is the meaning of *nix?
- How do I find all files containing specific text on Linux?
- How to unmount a busy device
- “Couldn’t find a file descriptor referring to the console” on Ubuntu bash on Windows
- Error in linux console : Couldn’t get a file descriptor referring to the console
- Error in linux console : Couldn’t get a file descriptor referring to the console
- How to unmount a busy device
- How to kill a process running on particular port in Linux?
- error: ‘Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)’ — Missing /var/run/mysqld/mysqld.sock
- performing HTTP requests with cURL (using PROXY)
- Bad File Descriptor with Linux Socket write() Bad File Descriptor C
- Where can I find php.ini?
- gzip: stdin: not in gzip format tar: Child returned status 1 tar: Error is not recoverable: exiting now
- Write to .txt file?
- error: ‘Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)’ — Missing /var/run/mysqld/mysqld.sock
- No space left on device
- How do I grep recursively?
- How can I recursively find all files in current and subfolders based on wildcard matching?
- How to perform grep operation on all files in a directory?
- error: lvalue required as unary & operand
- “E: Unable to locate package python-pip” on Ubuntu 18.04 [duplicate]
- How to upgrade pip3?
- What is the LD_PRELOAD trick?
- Amazon Linux: apt-get: command not found
- How to install grub after installing Windows 10
- Linux: ‘Username’ is not in the sudoers file. This incident will be reported
- How can I use ant
to execute commands on linux? - how to find libstdc++.so.6: that contain GLIBCXX_3.4.19 for RHEL 6?
- How to extract C source code from .so file?
- How to print pthread_t
- error: lvalue required as unary & operand
- Pass a password to ssh in pure bash
- subprocess.Popen(): OSError: [Errno 8] Exec format error in python?
- “E: Unable to locate package python-pip” on Ubuntu 18.04 [duplicate]
- How to substitute shell variables in complex text files
- How to upgrade pip3?
- -bash: syntax error near unexpected token `newline’ for display command
- How can I recursively find all files in current and subfolders based on wildcard matching?
- Why am I getting “undefined reference to main”
- How do I use grep to search the current directory for all files having the a string “hello” yet display only .h and .cc files?
- connect Error: “No route to host”
- Python virtualenv questions
- SSH using python script
- Curl command for https ( SSL )
- How to activate virtualenv in Linux?
- How can I exclude directories from grep -R?
- “No X11 DISPLAY variable” – what does it mean?
- How to exclude a directory in find . command
- “sed” command in bash
- How can I exclude directories from grep -R?
- Changing the resolution of a VNC session in linux
- Using putty to scp from windows to Linux
- gcc: error: unrecognized command line option
- How to exclude a directory in find . command
- How can I find all *.js file in directory recursively in Linux?
- mysql_config not found when installing mysqldb python interface
- Linux error while loading shared libraries: cannot open shared object file: No such file or directory
- What languages are Windows, Mac OS X and Linux written in?
- How to set proxy for wget?
- Shell command to tar directory excluding certain files/folders
- Argument list too long error for rm, cp, mv commands