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 |
247
votes
Accepted
How to fix pagination for custom loops?
category__not_in', array( 5 ) );
}
}
add_action( 'pre_get_posts', 'wpse120407_pre_get_posts' );
That way, WordPress will use the already-modified $wp_query object when determining pagination, with no …
224
votes
Accepted
Between functions.php (theme), widgets, and plugins, which is loaded first?
For most cases everything should be hooked and executed no earlier than init hook. According to Codex widget registration with register_widget() should be hooked to widget_init. …
213
votes
Accepted
How to check if a user is in a specific role?
UPDATE: Passing a role name to current_user_can() is no longer guaranteed to work correctly (see #22624). …
168
votes
Accepted
Using wpdb to connect to a separate database
Absolutely no need to be Wordpress related, which is very interesting. … The benefit is the ability to use all the wpdb classes and functions like get_results, etc so that there's no need to re-invent the wheel. …
165
votes
Accepted
Uninstall, Activate, Deactivate a plugin: typical features & how-to
The plugin setup callbacks are triggered by core and you have no influence on how core does this. There're some things to keep in mind:
Never, ever echo/print anything(!) during setup callbacks. … Sadly so far there's no possibility to run something on plugin/theme install or update/upgrade. …
164
votes
Accepted
When to use WP_query(), query_posts() and pre_get_posts
The methods used in the loop above are no longer available to you. This isn't a 'Loop', simply an array of post object.
<ul>
<? …
158
votes
Accepted
Is moving wp-config outside the web root really beneficial?
FALSE: Imagine your server defaults for a virtual host are: no PHP, no .htaccess, allow from all (hardly unusual in a production environment). … Argument 4: Unauthorized access to wp-config.php is no big deal
The database information is really the only sensitive stuff in
[wp-config.php]. …
150
votes
Accepted
Adding a Taxonomy Filter to Admin List for a Custom Post Type?
July 2024 UPDATE:
This code no longer works. Tested in the current version of WP at the time of writing (6.5.5). … First thing you need to do is to hook the restrict_manage_posts action which has no parameters and is called from /wp-admin/edit.php (in v3.0.1 that call is on line 378.) …
144
votes
Accepted
Allow HTML in excerpt
Please take note, this new excerpt will still be callable as the_excerpt() in template files, no need to change that. get_the_excerpt() is located in wp-includes/post-template.php. … function wpse_allowedtags() {
// Add custom tags to this string
return '<script>,<style>,<br>,<em>,<i>,<ul>,<ol>,<li>,<a>,<p>,<img>,<video>,<audio>';
}
If you need to allow all HTML tags, that is, no …
142
votes
Accepted
Organizing Code in your WordPress Theme's functions.php File?
However NO Significant Performance Gain From PHP Code Organization
On the other hand structuring your PHP files is 99% about creating order and maintainability and 1% about performance, if that (organizing …
141
votes
Accepted
Tips for using WordPress as a CMS?
Custom Post Types in WordPress 3.0
Explore the Power of Custom Post Types to Maximize WordPress as a CMS
Smarter Custom Post Types
There are also several plugins to make Custom Post Types easier in no …
139
votes
17
answers
107k
views
Adding a Taxonomy Filter to Admin List for a Custom Post Type?
'new_item' => __( 'New Listing' ),
'view' => __( 'View Listing' ),
'view_item' => __( 'View Listing' ),
'search_items' => __( 'Search Listings' ),
'not_found' => __( 'No … listings found' ),
'not_found_in_trash' => __( 'No listings found in Trash' ),
'parent' => __( 'Parent Listing' ),
),
'singular_label' => __('Listing'),
'public' => true …
138
votes
36
answers
18k
views
Objective Best Practices for Plugin Development? [closed]
UPDATE: After seeing the first few responses it becomes clear that we need to have only one idea/suggestion/best-practice per answer and people should review the list to ensure there are no duplicates …
134
votes
Accepted
get_template_directory_uri pointing to parent theme not child theme
WordPress core in wp-includes/default-constants.php and basically look like this:
define('TEMPLATEPATH', get_template_directory());
...
define('STYLESHEETPATH', get_stylesheet_directory());
If there is no …
131
votes
Accepted
Hide the fact a site is using WordPress?
'/new-wp-content' );
Set WP_CONTENT_URL to the full URI of this directory (no trailing slash), e.g. … '/new-wp-content/new-plugins' );
Set WP_PLUGIN_URL to the full URI of this directory (no trailing slash), e.g. …