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?
- Bash: No such file or directory?
- What’s a .sh file?
- How to create a file in Linux from terminal window? [closed]
- sudo: npm: command not found
- Openssl : error “self signed certificate in certificate chain”
- How to unmount a busy device
- How to unmount a busy device
- How to kill a process running on particular port in Linux?
- No space left on device
- error: lvalue required as unary & operand
- error: lvalue required as unary & operand
- “No X11 DISPLAY variable” – what does it mean?
- How can I exclude directories from grep -R?
- Pseudo-terminal will not be allocated because stdin is not a terminal
- Directory Inode vs Regular File Inode
- How to cat <
> a file containing code? - Diff command along with Grep gives “Binary file (standard input) matches”
- can’t remove python pip
- How would I get a cron job to run every 30 minutes?
- How to automatically redirect HTTP to HTTPS on Apache servers?
- What is Options +FollowSymLinks?
- valgrind – Address —- is 0 bytes after a block of size 8 alloc’d
- Compiling C++ on remote Linux machine – “clock skew detected” warning
- Why cannot the JVM auto expand heap memory to the configured Xmx3072m in linux & jdk1.6.0_32, and FullGC occurs very frequently
- tar: Cowardly refusing to create an empty archive
- How to use su command over adb shell?
- Post request with Wget?
- Telnet [Unable to connect to remote host: Connection refused]
- G++ undefined reference to class::function
- malloc(): memory corruption
- Terminal Multiplexer for Microsoft Windows – Installers for GNU Screen or tmux
- Is there an alternative sleep function in C to milliseconds?
- How do I update a Python package?
- Gedit command not working in kali linux terminal
- Syntax error near unexpected token ‘then’
- Curl : connection refused
- How to install Android SDK on Ubuntu?
- Java command not found on Linux
- How can I use grep to show just filenames on Linux?
- Bash script prints “Command Not Found” on empty lines
- Bash export command
- How to edit gitignore file
- Adding a new entry to the PATH variable in ZSH
- Downloading Java JDK on Linux via wget is shown license page instead
- How does one suppress a 404 status code in a WordPress page?
- How to configure WP filesystem access in Linux (Ubuntu Server)?
- Transferring contact form input to an email account without using an email-proxy
- URL rewriting for WordPress Network (Multisite) subsite
- plugins_url() incorrectly returns a url with www subdomain
- Can’t upload media to my Raspberry Pi WordPress server
- Definitive wordpress directory ownership and permissions on linux
- What happen after new plugin get installed in term of permissions?
- Dynamically update Site/WordPress Address
- check if a file in a plugin folder exists from a locale installation
- Does WordPress create a new Linux user when creating a new WordPress blog?
- reCAPTCHA on page template without plugin
- Need help changing back the correct wordpress url
- Fastest way to install a multisite?
- My WordPress is giving me an 403 error when saving post/draft with specific words
- How do I prevent a folder from reappearing in my home directory?
- Folder Permissions + Security Concerns
- How to use plugins_url() inside PHP stylesheet file [duplicate]
- 504/502 errors plauging our site
- How to run a server on port 80 as a normal user on Linux?
- Moving an already-running process to Screen
- Permission denied (publickey). SSH from local Ubuntu to Amazon EC2 server
- How to run a command multiple times, using bash shell?
- LVM dangers and caveats
- How to reconnect to a disconnected ssh session
- Should I quit using Ifconfig?
- How to know from which yum repository a package has been installed?
- SSL Certificate Location on UNIX/Linux
- What is “-bash: !”: event not found”
- tar – Remove leading directory components on extraction
- Keeping a linux process running after I logout
- Force dig to resolve without using cache
- How to list Apache enabled modules?
- How to forcibly close a socket in TIME_WAIT?
- How to check if an RSA public / private key pair match
- Colors in bash after piping through less?
- How can I monitor hard disk load on Linux?
- Why does sudo command take long to execute?
- “POSSIBLE BREAK-IN ATTEMPT!” in /var/log/secure — what does this mean?
- How to display certain lines from a text file in Linux?
- What’s the reverse DNS command line utility?
- How to add a security group to a running EC2 Instance?
- How bad is it really to install Linux on one big partition?
- How do I extract login history?
- SSH from A through B to C, using private key on B [closed]
- Is it possible to reboot a Linux OS without rebooting the hardware?
- Does the “bs” option in “dd” really improve the speed?
- What solutions exist to allow the use of revision control for server configuration files? [closed]
- Is there a way to do a remote “ls” much like “scp” does a remote copy?
- Dump a linux process’s memory to file
- What is the difference between /sbin/nologin and /bin/false?