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 |
A function is a sequence of program instructions that perform a specific task. It is packaged as a unit that can be used wherever the according task should be performed.
11
votes
Accepted
Perform an action when post is updated/published
php
add_action( 'save_post', 'wpse41912_save_post' );
function wpse41912_save_post()
{
// do stuff
}
If you want your functions to fire only when a post is being edited, you can hook into edit_post …
10
votes
Accepted
get_term_by not working when in functions.php
The WordPress environment is loaded when a theme's functions.php file loads, but many plugins/themes/core functions don't register taxonomies until later. …
10
votes
Get rid of Wordpress category, tag and author archives?
Essentially you hook in some place late after WordPress knows what page is requested (like template_redirect), use one of the conditional functions and either use $wp_query->set_404() or just redirect …
7
votes
Accepted
How to detect first visit of a user?
No, there's nothing in the core like that.
You can set a cookie and do it simply enough (warning: untested code follows).
<?php
function is_first_time()
{
if (isset($_COOKIE['_wp_first_time']) | …
6
votes
Accepted
Is it possible to remove the "standard" post format?
The first thing to remember about the post editing screen is that everything (except for the post title, editors, permalink, etc.) is a meta box. Since you can easily add and remove meta boxes, there …
6
votes
Accepted
Multiple Content Block
I would keep the primary content field and add a metabox + a secondary instance of the wp editor (using the handy wp_editor function).
Custom field values are stored in the database as LONGTEXT, so t …
5
votes
How can I remove the title "leave a reply" in the comment box in twentyeleven?
You can filter the default comment_form arguments (which is what's causing the "leave a reply").
Just drop this in functions.php or in a plugin file. It would probably be better to put it in a plugi …
4
votes
hook a functions to change wp-config from functions.php
Are there hooks in those functions/whatever that you could used to accomplish the same thing as redefining the variable? …
3
votes
Accepted
Replace single_template filter with what for default posts?
Allows for more generic template location
* without the use of the other get_*_template() functions.
*
* @since 1.5.0
*
* @param string $type Filename without extension. …
2
votes
hide shortcode using hooks
Instead of removing the shortcode, re-register it with a function that returns an empty string (or something that casts to an empty string). You can use the built in __return_empty_string. This will r …
1
vote
wp_enqueue_script() not working
The social network button you posted comes in two distinct parts.
First, the button itself is defined by the anchor tag.
<a href="http://svejo.net/submit/?url=[your url]"
data-url="[your url]"
…
1
vote
Accepted
hook for dashboard show_user_profile
show_user_profile is the wrong hook to use. You should redirect before anything gets sent to the browser (eg. before headers are sent).
Fortunately there are actions that happen much earlier: load-{ …
1
vote
Prevent Data Resubmission On Page refresh
submitting & duplicating the rating data on page refresh.
If it's only an issue for page refreshes redirect the user after form submission. This will prevent re-submission because the browsers c …
0
votes
Import Wordpress XML File from Within Functions.php
There is no theme equivalent of register_activation_hook for plugins -- there are a few hacks. Why? Because a theme is a skin. Only functionality specifically related to the display of content should …