Tagged Questions
0
votes
0answers
32 views
How to add X number of products to woocommerce cart at once
I am trying to add x number of products input and button to my catalog page so I can select a number, then hit add to cart.
Is it possible to add in this function? The user will provide a number ...
1
vote
1answer
50 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
0answers
46 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
1answer
77 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 ...
2
votes
1answer
43 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
79 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
1answer
71 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 ...
2
votes
1answer
262 views
Trigger custom action when setting button pressed
This is my first wordpress plugin and I'm running a lot of trouble making it work, it almost work fine but I don't find a way to accomplish this specific thing.
Basically I've my custom setting page ...
0
votes
1answer
112 views
frontend show edit profile with selected custom options
So I have many custom user profile fields.
When I use do_action( 'show_user_profile', $profileuser ); hook it displays all custom user profile fields..
But I would like to show only certain fields. ...
1
vote
2answers
283 views
Check if action hook exists before adding actions to it
I am trying to add a rel=next and rel=prev link tags to the head element of image.php template file. I have Wordpress SEO installed and I like to hook to this plugin wpseo_head action hook to achieve ...
2
votes
5answers
233 views
How do I make a theme “plugin-ready”?
How do I revise a theme so that I can publish my event hooks and anyone can build a plugin to add new functionality easily to my theme?
1
vote
0answers
42 views
Copy post to separate database with “add_action(…)”
I'm basically trying to have a copy of a post be sent to another database's table when it's published. I've gotten it to add a new row in the new table, with my own static arguments, but I'm not sure ...
0
votes
2answers
115 views
Divs appearing everywhere in post content
Whenever somebody writes a post on our site, the Paly Voice (http://palyvoice.com) there are automatically a lot of <div> elements created. This is bad for layout, since we have a style that ...
3
votes
1answer
298 views
Using action hooks inside of a shortcode
I am trying to create a modular plugin that includes action hooks for developers to add content before and after the main shortcode content. I'm having some trouble because anything I do in the ...
0
votes
1answer
166 views
Redirect back to origin page after using get_delete_post_link()
I need to implement frontend and backend redirection after delete specific post using get_delete_post_link(). Which hook i can use? Any advice would be appreciated.
Something similar to :
<?php ...
4
votes
1answer
72 views
How Do I Load My Action Earlier Enough?
With add_action, I want to intercept as early as I can in my plugin and send a 304 Not Modified header per some rules. Does anyone know what the order is of events? When I view this page, it seems to ...
7
votes
2answers
933 views
Why do some hooks not work inside class context?
I'm pretty stumped on this one. I'm using add_action inside my plugin class to do certain things- add scripts & styles to the head, wp_ajax, etc. Here's the actions, in the __construct:
function ...
0
votes
2answers
226 views
How to get post ID with hooks publish_post, new_to_publish, etc
I have two plugins, one uses the function wp_insert_post(), the other has a code like this:
add_action('future_to_publish', 'myFunc', 10, 1);
add_action('new_to_publish', 'myFunc', 10, 1);
...
0
votes
1answer
94 views
Bug: Post needs to be updated twice when adding action for save_post hook
My function does exactly what I want it to do: I'm trying to add/update meta fields in another post type when an "events" post is saved. Except the post needs to be updated twice for the information ...
0
votes
1answer
1k views
add_action hook for publish_post not working
I can't get my function to trigger on post update or save. I've found a couple of other forum posts around with the same problem, but never an answer :(
My code is as simple as:
function ...
1
vote
2answers
559 views
How to get post ID in post_updated action hook?
I want to execute a function, myfunction() [hypothetically named], whenever a page is updated in the admin. The function doesn't do anything to the content that is saved—it just runs an unrelated task ...
1
vote
2answers
120 views
how to determine how many and what kind of arguments are passed to hooks
I am not able to understand a very logic behind add_action / add_filter
Consider following example:
function SearchFilter($query) {
if ($query->is_search) {
$query->set('post_type', ...
0
votes
1answer
207 views
Post via wp-admin and via iOS app, same hooks and triggers involved?
I've got an add_action in functions.php, the action is for save_post and the function I'm running I've named set_attachment_url. I'm simply getting the first attachment on a post and setting a custom ...
6
votes
2answers
708 views
Extract image from content and set it as the featured image
The problem:
I'm posting from the Wordpress iPhone app. When adding an image, the image shows up in the description itself, which I don't like.
What I'm trying to do:
Remove the image from the ...
5
votes
3answers
1k views
How to know what functions are hooked to an action/filter?
Is there a way to know what functions are hooked to a particular hook? For example if I'd like to know what functions are hooked to the wp_head hook.
Thanks in advance.
0
votes
2answers
454 views
How can I recover the post ID earlier in the WP admin hook action “firing” sequence?
Hopefully this question will make sense, and I will apologise now for my inexperience in WP and PHP, in case I am making a full-blown newbie error :o)
OK... I am creating a WP plugin based around ...
0
votes
3answers
455 views
What action hook can I use to add a JavaScript to a page post using a theme template that is not including get_header() nor get_footer()?
So the reason why I am don't want to include get_header() or get_footer() tags is because this page will be loaded as an iframe using the thickbox modal plugin and its content will be a form and I ...
3
votes
1answer
2k views
Difference between after_setup_theme and init action hooks?
What is the difference between the after_setup_theme and init action hooks? It seems they are both called right before any page in WordPress is loaded (even admin pages).
4
votes
5answers
484 views
Implementing advanced add_* function wrappers
add_action() and add_filter() are major functions. However in some scenarios add one more function and hook it somewhere approach gets bulky and inconvenient.
I had determined for myself several use ...