Method by which plugins and themes extend core WordPress functionality.
0
votes
1answer
53 views
the_posts hook, which set of posts?
I want to modify search results. Currently I hook to the_posts and check wp_query->is_search to determine if I am looking at the search results page.
However, I noticed that the_posts is executed ...
1
vote
1answer
37 views
How do wordpress hooks respond to user interaction?
Embarrassingly big hole in my understanding!
When I've finished editing a post and click the big blue "Update" button, what happens next? In particular, how does the 'pre-post-update' hook (which, ...
1
vote
0answers
27 views
Hooks are not being removed in child theme
I have a hook file:
function load_admin_package(){
do_action('load_admin_package');
}
/*
* -----------------------------------
* Define hooks bellow
* -----------------------------------
*/
...
0
votes
3answers
68 views
Hook on trash post
I want to perform an action when I delete one of my custom post types, which hook should I use:
wp_trash_mycpt
or
trash_mycpt
My action should run solely when mycpt is in the 'publish', 'draft' ...
0
votes
1answer
13 views
Hooking in to an archive page?
I'm making a custom post type that I want to use in the form of a plugin - all pretty straight forward.
However, I want the archive page for this post type to look slightly different in the content ...
2
votes
1answer
120 views
Issue with get_theme_mod returning a blank value instead of the saved value
I have what seems to be a rather troubling issue with the get_theme_mod function in the latest version of Wordpress. Only on particular servers (of which meet all Wordpress requirements) the function ...
0
votes
1answer
76 views
Alternative to new_to_publish Hook for Custom Statuses
I am looking for the right hook to use for sending out an email notice when a post is inserted. However, I am using custom statuses (in this case 'holding') which doesn't seem to get hit with the ...
0
votes
1answer
34 views
Which hooks are essential for post templates?
Im in the process of building a very custom theme and Im beginning to work on the post templates, but I dont know which hooks are essential for them.
So like, I've seen (but cant remember where)some ...
0
votes
1answer
83 views
Restrict certain actions to plugin-specific admin menu pages only
I'm working on a plugin and want to restrict some things to my plugin-specific admin menu pages only. Therefore, I write the slugs being returned when adding (sub)menu pages into an array so I can ...
0
votes
1answer
77 views
Does the 'nav_menu_css_class' filter accept 2 or 3 arguments?
I've been using the nav_menu_css_class filter in one of my plugins, implemented as:
add_filter( 'nav_menu_css_class', 'wbwcrf_nav_menu_css_class', 10, 3 );
function wbwcrf_nav_menu_css_class( ...
0
votes
2answers
70 views
How to add style to a string of text throughout WordPress website?
I am building a site for a friend, the site has launched, now he tells me he wants his site name to appear green everywhere it appears on the website.
Immediately, I thought of the plugin SEO Smart ...
0
votes
1answer
52 views
How to modify post content?
I still haven't figured this out yet.
Is this the right way? I tried $_POST['content'] = "nothing" and $_POST['content'] = 0 neither work for me. I'm using following way
function changeContent() {
...
0
votes
1answer
29 views
Hook into a function without a hook?
I have just got into using hooks and have now understand the beauty of them. I understand that I can hook into the following by using add_filter('hook_name','my_hook_name', $variable);
function ...
1
vote
2answers
136 views
How to modify post content before writing to database?
Hi~ I'm back again and I'm trying to add another function to the script I was working on a plugin that notify my friends of new post that mentions(@) them. Now I want to change the plain text of my ...
0
votes
2answers
82 views
How to use the 'comments_number' filter?
I'm not sure how to use this filter. Could someone show me an example? I'm trying to change ('0', '1', '%') to ('0 Comments', '1 Comment', '% Comments').
I'm using this function to get the comments ...
0
votes
2answers
65 views
Action hook to control access to certain parts of my site
I'm searching for an action hook which I can use to control access to certain parts of my Wordpress site. I want to write some custom PHP which will check certain user attributes and decide if they ...
0
votes
1answer
29 views
Meta boxes not showing up
Okay so I'm trying to render a meta box.
This is what I have so far, trying to keep it as basic as possible:
add_action('load-post.php', 'ad_templates_callback' );
add_action('load-post-new.php', ...
2
votes
0answers
68 views
Placement of Code in Plugin for hooking `save_post`
I ran into a strange Problem today developing a new Plugin.
I set it up as usual, creating the f711-roomprice folder in the Plugindirectory, and creating the f711-roomprice.php as well as an inc ...
1
vote
1answer
104 views
Better post meta efficiency?
I work with websites which require using Post Meta for Post Objects within a particular Post Type.
I often add a Meta Box to a particular Post Type, to provide additional settings for the new Post ...
1
vote
1answer
59 views
Detect type of post status transition
I have a function on my site that it supposed to run when a new post is published (email push notification), with the exception of the same article updated (i.e publish_to_publish transition, I don't ...
1
vote
1answer
140 views
Hooking after get_header()
Does anyone know a good way to hook just after get_header() without hacking the theme? I know you can hook before the function loads header.php but I am trying to insert some HTML just after ...
0
votes
1answer
70 views
Removing Submenu from Menu
Thesis appears to automatically add the sub-menus (sub-menu ul) to menu parents if childs exists. I have a specific need to remove this html from a particular menu.
The menu name is: second_level
...
0
votes
1answer
51 views
Bloginfo hook - can it be more precise?
From the codex, regarding filter hooks:
bloginfo_url
applied to the the output of bloginfo("url"), bloginfo("directory") and bloginfo("home") before returning the information.
Is there a way I ...
1
vote
1answer
37 views
How to display a message about updates in the plugin list
I am trying to use the hook in_plugin_update_message in order to display a one line message below the name of my plugin in the admin plugin list section.
However, the function called in the hook does ...
-1
votes
2answers
55 views
Hooks are not executing
Based on my understanding of hooks, you create a hook, by doing do_action('hook_name'); then add something to said hook and call the method where you want it to do the hook, so:
public function ...
1
vote
1answer
39 views
Create hooks based on an array of hook names?
I have this idea where I would create a class that would take in a set of hook names then create them, for me to use when ever, and where ever.
Currently the way to create a hook is we do something ...
1
vote
0answers
50 views
add_action on inherit post status
I'm trying to use the add_action() hook to run a custom function, but am struggling with the post status.
I originally tried using:
add_action('pending_to_publish_portfolio', 'my_function');
...
0
votes
0answers
21 views
debugging in WordPress tapping into the all hook [duplicate]
On Nacin's blog (http://nacin.com/2010/04/23/5-ways-to-debug-wordpress/) there is this section; I quote
The ‘all’ and ‘shutdown’ hooks*
There’s an ‘all’ hook that fires for all actions and ...
0
votes
1answer
76 views
“admin_enqueue_scripts” hook or $_GET['page']?
When adding a function to "admin_enqueue_scripts" a hook is passed to the function. It looks like this "toplevel_page_nameofyourpage". That works great, but how is it different from checking the $_GET ...
2
votes
2answers
68 views
Action hook 'wp' firing twice… why?
I noticed that when I hook into 'wp' it seems to be firing twice -- for example
add_action('wp', 'just_testing');
function just_testing(){
global $post;
error_log($post->ID);
}
returns ...
0
votes
1answer
102 views
Would there be anything stopping me from removing both wp_head and wp_footer?
Some plugins rely on either wp_head or wp_footer or both to introduce their own stylesheets and JavaScript. Those scripts take time to load and slow down my website. Therefore, I would like manually ...
0
votes
1answer
59 views
Auto log in hook is requiring a page refresh
I have a simple auto log in hook that looks like the following:
function auto_login() {
if (!is_user_logged_in()) {
//Removed some code for brevity.
$user = ...
2
votes
2answers
74 views
How to check what kind of saving it is?
I use save_post hook, and I have to know inside this hook function, whether it is a publishing ( draft to publish ) or is it an updating, like publish to publish or draft to draft.
Is there a way to ...
2
votes
1answer
39 views
Hook to edit an column on comments screen?
At the moment I'm doing
add_filter("manage_edit-comments_columns", function($columns) {
unset($columns["author"]);
$columns_one = array_slice($columns,0,1);
$columns_two = ...
2
votes
1answer
93 views
publish_post plugin hook doesn't always pass $post->post_content
I've written a simple plugin that grabs the contents of a post, as the post is published, and sends them to an external site for archiving. This generally works but when dealing with posts that ...
0
votes
1answer
182 views
Admin post list - adding an option to the date filter dropdown
I've been asked if I can add an option for "Today" and "Yesterday" to the date filter dropdown at the top of the post list in the WordPress admin view. (This is the list that shows recent ...
0
votes
3answers
67 views
Need to return shortcode text instead of the output
Is there a way I can return the shortcode text instead of the output.
My code function is hooked into 'the_content' and I know if my function contain shortcode it will automatically generate the ...
2
votes
1answer
117 views
Post thumbnail relative link and HTML modify
I want to remove the website url from all the_post_thumbnail() so they become relative and remove/add attributes from the output.
So far I got the following code added to functions.php of the theme, ...
0
votes
2answers
57 views
How to prevent double execution of do_action statements
Is there any way to prevent double execution of do_action statements? For example, I have the following lines:
do_action('myhook1', 'myfunction1');
do_action('myhook2', 'myfunction2');
...
2
votes
1answer
48 views
Perform action on WPMU blog deletion
Hi guys :) I know there is the wpmu_new_blog action hook which enables us to perform an action when a new WPMU blog is created. Is there something similar to this which enables us to perform an action ...
0
votes
1answer
89 views
Wordpress image resize hook
Any relevant help will be appreciated.
I want to make rounded cornres on images off certain image size. For example I have
add_image_size('xx', '320', '320', true);
Can I hook to this function and ...
0
votes
1answer
91 views
How to place a div inside a function that creates a div
I am wondering how instead of having the menuTab div come after the bones_main_nav function html code that is outputted to have it injected inside of it I suppose.
I have the following function
// ...
0
votes
1answer
474 views
How do I implement the Wordpress Iris picker into my plugin on the front-end?
This question here is asking the same question as I am, but there were no adequate answers nor a selected correct answer so I am asking again hoping if I ask in a more coherent manner I might get a ...
-1
votes
1answer
162 views
Genesis Widgets Don't Make Use of Hooks? [closed]
Not sure if it's just this one widget in particular or if I'm doing something wrong but it seems that the Featured Post widget doesn't call the hooks for the content. I have the widget added to my ...
0
votes
2answers
166 views
WordPress Ajax Problems
Update
I got it to fire using the following curl command:
curl -H "Accept: application/json" -X POST http://localhost/wordpress/wp-admin/admin-ajax.php -d ...
2
votes
1answer
89 views
How to remove the Theme Customization Button from the dashboard and themes options page?
In my Wordpress theme that I've currently been building I do not take advantage of the Wordpress Theme Customization API. As much as I would like too, I've invested far too much time into my own ...
0
votes
1answer
109 views
How can I hook into creating a new post and execute wp_die(), before the post is inserted into the database?
Info about wp_die from codex: Kill WordPress execution and display HTML message with error message. A call to this function complements the die() PHP function. The difference is that HTML will be ...
1
vote
0answers
134 views
get_query_var() not working in pre_get_posts
I'm using the pre_get_posts hook to order the main query on all my custom post type / taxonomy pages using a custom meta value. As part of the logic, I am trying to determine which taxonomy is ...
1
vote
1answer
75 views
Implement Hooks Using Array
I'm trying to implement some hooks into a theme, but rather than write out every hook with repetitive code I was wondering if I could use and array to declare the hooks instead.
E.g. ordinarily i'd ...
0
votes
2answers
58 views
How to hook into publish_posttype?
I'm trying to hook into WordPress publish. The code below is what I'm using, but it doesn't appear to be running. I have it in a plugin file that I deactivate/reactivate each time I make changes ...
