It seems that plugin_url() cannot be used in classes. This causes an error.
<?php
/*
* Plugin Name: plugins_url
* Description: This demonstrates plugins_url() causes an error used in a class definition.
* Version: 1.0
* Author: teno
*/
class SampleClass {
$url = plugins_url('test.php', __FILE__);
}
?>
I need to define the file url in a class. The file is located in the plugin folder. Any solution?
plugins_url()in any class. The question you linked to has nothing to do with your problem. Your code is just a syntax error: you cannot use a function for a variable definition. – toscho♦ Aug 19 '12 at 22:47