Understanding SHORTINIT with WordPress 5
You could test if the request is coming in through the rest API before enabling the SHORTINIT Something like… if (strpos($_SERVER[ ‘REQUEST_URI’ ], ‘/wp-json/’) !== false) { define(‘SHORTINIT’, true); }
You could test if the request is coming in through the rest API before enabling the SHORTINIT Something like… if (strpos($_SERVER[ ‘REQUEST_URI’ ], ‘/wp-json/’) !== false) { define(‘SHORTINIT’, true); }
My guess is – yes, you are stuck with exactly that. Checks for EMPTY_TRASH_DAYS seem to be hardcoded as condition for switching interface between trash and delete in several places.
Reference file in current path or deeper nested To reference the current path plugin_dir_path( __FILE__ ).”further/nesting/here.css”; which works in Plugins and Themes. Reference URl/URi in a plugin To point to a plugin or theme file, use plugins_url( “path/to/file”, __FILE__ ); which works only in plugins Reference URl/URi in wp-admin folder Always point them to admin_url( … Read more
The reason is that const for the parameter only applies locally within the function, since it is working on a copy of the data. This means the function signature is really the same anyways. It’s probably bad style to do this a lot though. I personally tend to not use const except for reference and … Read more
I’m curious about the benefits/detriments of different constant declaration and definition options in C++. For the longest time, I’ve just been declaring them at the top of the header file before the class definition: While this pollutes the global namespace (which I know is a bad thing, but have never found a laundry list of … Read more
Your desire not to modify t is expressed in const T& t. The ending const specifies that you will not modify any member variable of the class abs belongs to. Since there is no class where this function belongs to, you get an error.
You should quote your array keys: As is, it was looking for constants called department, name, email, message, etc. When it doesn’t find such a constant, PHP (bizarrely) interprets it as a string (‘department’, etc). Obviously, this can easily break if you do defined such a constant later (though it’s bad style to have lower-case … Read more
Got it. I assumed it’d figure out that the > operator returned a bool (per documentation). But apparently it is not so.
JLS-8.3.1.1. static Fields says (in part) A static field, sometimes called a class variable, is incarnated when the class is initialized (§12.4). JLS-4.12.4. final Variables says (in part) A constant variable is a final variable of primitive type or type String that is initialized with a constant expression (§15.28) tl;dr Putting that together, a class constant is a static final field.
When relying upon ECMAScript 6 features such as const, you should set this option so JSHint doesn’t raise unnecessary warnings. /*jshint esnext: true */ (Edit 2015.12.29: updated syntax to reflect @Olga’s comments) This option, as the name suggests, tells JSHint that your code uses ECMAScript 6 specific syntax. http://jshint.com/docs/options/#esversion Edit 2017.06.11: added another option based on this answer. While inline … Read more