Skip to main content

Questions tagged [namespace]

The tag has no summary, but it has a tag wiki.

0 votes
1 answer
55 views

For some reason I can't get the admin_notices action to work. For context, I am trying to show errors when my custom post type is saved and fields fail validation. However I have stripped out most of ...
zcesl53's user avatar
  • 45
0 votes
1 answer
560 views

Imagine the following script: <?php namespace MySpace; class MyClass { public static function execute() { // Do something post_exists(1,'','','my_post_type'); } } ?> I'm now ...
DevelJoe's user avatar
  • 547
0 votes
0 answers
25 views

I'm working on a plugin, and I'm trying to get to grips with namespaces and how they work with actions. In a separate file, I have a single function with a namespace declared at the top: namespace ...
verism's user avatar
  • 216
0 votes
1 answer
419 views

I wrote a function in my theme's functions.php and am attempting to register it with add_shortcode() as shown in the Codex: <?php /** * theme's functions.php */ namespace MyNamespace; //[foobar]...
Jacob Ford's user avatar
0 votes
0 answers
608 views

I want to use namespaces instead of prefixes for a plugin, since now the minimum supported PHP version for WP is 5.6.20 and namespaces can be used. But it does not seem to work with hooks: namespace ...
Álvaro Franz's user avatar
0 votes
1 answer
499 views

My workaround at the moment, within a shortcode, is to just copy the WP native code to get the Timezone within my (namespaced) class: new \DateTimeZone( $this->wp_timezone_string() )); private ...
MikeiLL's user avatar
  • 609
0 votes
1 answer
185 views

I have my theme, with a folder called classes, with a single class: wp-content |- themes |- mycustomtheme |- classes |- FooBar.php In FooBar, I would like to use this package here: ...
Zeth's user avatar
  • 938
0 votes
1 answer
513 views

I wrote a WP theme using namespaces and autoload. Everything went smooth until I started to use WP classes which I understand of course because I understand how namespacing works. My question is, is ...
Amir Rami's user avatar
  • 123
0 votes
1 answer
274 views

Consider the following code copied from ACF docs, refactored to work inside a namespace: add_filter('acf/location/rule_match/user', __NAMESPACE__ . '\acf_location_rule_match_user', 10, 4); function ...
Abe Caymo's user avatar
  • 223
1 vote
1 answer
2k views

I want to use namespace in my plugin. And I have error after PHP_Code_Sniffer check. Namespaces declared by a theme/plugin should start with the theme/plugin prefix. Found: "eustatos\test_plugin". (...
eustatos's user avatar
  • 111
1 vote
1 answer
1k views

I originally posted in the Sage forum here. I'm trying to get a plugin to work but it's not, and I feel like it's a very general Namespace problem, and not something with the actual plugin, so I ...
Kenny's user avatar
  • 125
1 vote
1 answer
279 views

For example I am inside a file1.php with a namespaced class, like so: <?php namespace FrameWork\CPT; class CPT{ ..... public function register_custom_post_type() { $args = array( '...
Abe Caymo's user avatar
  • 223
0 votes
1 answer
955 views

I am new to OOP and developing plugins. I have developed a plugin using the Plugin-Boilerplate with namespace. I expanded the boilerplate to include a REST folder and class so I could create custom ...
dsj's user avatar
  • 83
0 votes
1 answer
2k views

I would like to override this plugin class in child theme : class-config.php namespace um; if ( ! defined( 'ABSPATH' ) ) exit; if ( ! class_exists( 'um\Config' ) ) { /** * Class Config ...
ArbreMojo's user avatar
0 votes
1 answer
383 views

I'm writing a simple plugin with oop and using namespaces and autoloading. Here is my main file: add_action('plugins_loaded', array(My_Test_Plugin::get_instance(), 'plugin_setup')); class ...
Amirition's user avatar
  • 355

15 30 50 per page