Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
WordPress Plugins allow easy modification, customization, and enhancement to a WordPress blog. Instead of changing the core programming of WordPress, you can add functionality with WordPress Plugins.
6
votes
Why The Init Hook For Custom Post Types
Surely the custom post type persists in the database somewhere so
doesn't have to be called on every init()?
No, it's not. Why would it need to be? A custom post type is a handful of variables …
6
votes
Accepted
How does gettext works for translating readme file of plugin?
Translations for readmes on .org are done through https://translate.wordpress.org. You could contribute translations for your own plugin if you wanted. Start by picking a locale/language you want to t …
5
votes
Accepted
Logs to check when the plugin was first installed for the first time
When plugins were activated is not logged by WordPress. If the plugin hasn't been updated then the file modified time in the file system might be useful for telling you when the plugin was at least up …
5
votes
Accepted
Settings not set after calling register_setting()
register_setting does not insert anything in the database. It's supposed to be run in admin_init, not just on activation, and is for building options pages with the Settings API and handles things lik …
5
votes
Accepted
Custom Wordpress Plugin will install new and not update
A plugin is treated as the same as another plugin if it has the same directory name. That's it. If your zip file contains the plugin files then the zip filename will be used as the directory name. If …
5
votes
Accepted
$_GET vs get_query_var()
get_query_var() gets variables from the main instance of WP_Query. It's the equivalent of running
global $wp_query;
$wp_query->get( 'posts_per_page' );
It is not directly related to $_GET in any way. …
4
votes
Accepted
class_exists returns different values
In PHP the files are parsed before they are executed, so function and class definitions are 'hoisted' so that they are defined at the beginning of execution, regardless of where they are defined. This …
4
votes
How to make "upgrade safe" theme for a plugin?
They just mean that you can create your own template for the plugin in a child theme so that the template isn't changed when the plugin is updated. This is both the 'upgrades safe' and 'industry stand …
4
votes
How to run an add_action hook for specific page
Put is_page() inside the callback function:
function include_regForm_validation() {
wp_register_script( 'jQuery_form_validation', 'https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.17.0/jq …
4
votes
wp_localize_script and host/browser cache
The data passed by wp_localize_script() is output in a <script> tag in the page HTML. So if you have this:
wp_localize_script( 'registered_script', 'serverData', array( 'posts' => $post_array ) );
…
4
votes
Accepted
Why am I getting an error when requiring a file in my plugin?
As the names suggest, plugin_dir_path() will get the filesystem path, while plugin_dir_url gets the URL.
A file path looks something like this /var/www/html/wp-content/plugins/my-plugin/ and can be us …
3
votes
Accepted
What's the better way to add an inline script?
wp_add_inline_script() is intended to be used for inline scripts that use or depend on another script that's been enqueued with wp_enqueue_script(). It ensures that the inline script is placed appropr …
3
votes
Accepted
Wordpress register_activation_hook table creation not working
The SQL for creating tables in dbDelta() has very specific requirements. From the codex:
You must put each field on its own line in your SQL statement.
You must have two spaces between the wo …
3
votes
Accepted
The Point of Using apply_filters()
The point is to allow developers to customise aspects of your theme or plugin.
When calling apply_filters() you provide a name and a value that you want developers to be able to filter.
For your exa …
3
votes
Accepted
Get Objects While Deleting term
Use the pre_delete_term hook, which fires before the actual deleting occurs, so the relationships will still be present.
function wpse_296972_pre_delete_term( $term_id, $taxonomy_name ) {
if ( $t …