Browsing Category

Wordpress actions

Remove WooCommerce action – hook unknown

In the WooCommerce template simple.php there is this action hook do_action( 'woocommerce_before_add_to_cart_button' ); There seems to be a function hooked to this because it generates

How can I filter variables of query_vars?

my code is like that: function add_rewrites(){ add_rewrite_rule( '^my_post_type/([^/]*)/([^/]*)/?', 'index.php?post_type=my_post_type&name=$matches[1]&sub_pages=$matches[2]', 'top' ); } add_action( 'init', 'add_rewrites' ); function add_custom_query_var( $vars ){ $vars[] = "sub_pages"; return

Get Taxonomy name from “registered_taxonomy” hook

I am using add_action to run a function after a taxonomy is created. Everything works but I can’t figure out how to grab the taxonomy

Grab meta data before post is saved

I’m trying to grab the metadata for a post before it is saved. I know that I could use the ‘post_updated’ hook ( to grab

Tell me, what filter to use?

Tell me, what filter to use? Data post already obtained from the database but not yet displayed on the screen for editing the post. Something

Hooking into WooCommerce REST API from a plugin

I’ve got a plugin that ties into the added_term_relationship action hook, however one of my clients that needs this plugin updates their store daily using

AMP – Change rel="canonical" from functions.php

the source action in /amp/includes/amp-post-template-actions.php is: add_action( 'amp_post_template_head', 'amp_post_template_add_canonical' ); function amp_post_template_add_canonical( $amp_template ) { ?> <link rel="canonical" href="<?php echo esc_url( $amp_template->get( 'canonical_url' ) );

What’s the difference between hooks, filters and actions?

It seems like the terms hooks, filters and actions are used interchangeably. What’s the difference between them? What do they do? How do I use

Add a filter inside an action init

Hello in the “action init” to fairly large function, but I would like to add a filter to modify the vars variables, for example the

add to head element based on shortcode contents

Trying to write a plugin that adds to head element based on generated page contents. A shortcut generates pagination, based on which I have to

Remove an action hook within a Class

I’ve got the following class declaration: class stachethemes_ec_main extends stachethemesevent_calendarstachethemes_main_template { and the following function with the action hooks: public function add_event_tab($slug, $title, $icon, $content

CF7 Form File Upload to FTP Servers Based on Dropdown Selection

I have a simple request form setup in Contact Form 7 with a dropdown selection of two facilities. There are two anonymous server addresses to

WordPress hooks to call a function inside a construct

I am trying to call a custom function inside the constructor function. Which action hook to be used? class myClass{ public function __construct(){ add_action('$hook', array($this,

Woocommerce – Second T&C checkbox doesn’t prevent checkout when left unchecked

I have a special checkbox I need placed only if the customer purchases one of two specific products. Code below looks for these product_ids, and

trigger save_post event programmatically

Is there a way to trigger the post saving or updating event in code? such as do_action('save_post', $post_id); The function here seems to imply that

Is this the correct way to load style sheets from parent theme and then from child theme in wordpress?

I am creating a child theme of a theme in WordPress. In Parent theme i have style.css and inside css folder of parent theme i

Back to Top 145132 wordpress questions, 32 Wordpress answers.
Wordpress related, All rights reserved
Powered by Creative Advertising