Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

Method by which plugins and themes extend core WordPress functionality.

0
votes
0answers
17 views

How to add custom class to WooCommerce checkout field? [on hold]

I'm trying to add a custom class to input HTML tag at a checkout page in WooCoomerce. For example: I want to add .smartform-zip to input with name billing_postcode and same thing with ...
1
vote
0answers
11 views

WordPress Gravatar filter is removing my custom attributes

I am trying to add a style attribute on all the custom gravatar images. However, it is removing the style attribute before final output. Here is the code I am using: $background = ''; $args = [$...
2
votes
1answer
37 views

Modifying values with add_action to be sent to db

I am struggling with this problem for hours now, what is going on is that somewhere before inserting the values into the db, this action is being called. do_action_ref_array('h5p_alter_user_result', ...
1
vote
1answer
21 views

Featured Image Action Hook

Is there a hook available that returns the featured image, once a featured image is set to a post? I checked Which action hook can I use when a featured image has been selected and the action hooks ...
2
votes
0answers
22 views

Hook into theme-switching later than `setup_theme`

I need to add a theme-switching logic to a site. Unfortunately, what I've tried already doesn't seem to work as required. The themes needs to switch based on whether the user is on the blog part of ...
4
votes
1answer
74 views

Extend core block in Gutenberg

for a project I have to extend the core block core/cover-image. For the first basic try I came up with the following code: PHP: add_action('enqueue_block_editor_assets', function() { ...
0
votes
0answers
10 views

How to delete meta-field which is registered with register_meta to Rest API

I'm working on a Wordpress integration and updating our WP JSON api v1 to v2. We have custom post types which use two custom meta-fields. One of them should be preserved to the WP's database while ...
1
vote
0answers
21 views

Get Time Taken By Each Action Hook in Wordpress

I am developing a Plugin, and want to record Time taken by each Action Hook, I am able to get all the Hooks Triggered on a Page with the Action and Priority, but i am unable to get the Time taken by ...
0
votes
0answers
13 views

When would it be best to hook AJAX functions on a back-end page?

I'm setting up my page as follows: add_action( 'admin_menu', [$this, 'addAdminMenu' ], 80 ); And its content: public function addAdminMenu() { $this->hook_suffix = add_theme_page( ...
0
votes
2answers
31 views

Get The Caller (Plugin / Theme / Core) For All actions & Hook in Wordpress

I am developing a plugin which will show the caller of all the Hooks & Actions on a Page in Wordpress just like QueryMonitor. I know that global $wp_action & $wp_filter has all the information ...
0
votes
1answer
33 views

Why does re-using this function not work? [closed]

I have a function that adds a class based on various statements, certain pages, cpt's you're on etc. I put this function in various sections within the page for styling purposes using <?php ...
0
votes
0answers
12 views

How to get a real-time notification about new post from the user I'm following with Ultimate Member plugin?

I'm using Ultimate Member plugin with extensions Real-time Notifications and Followers. I need users to get notifications when users, they are following to, publish new blog post. I can't get any ...
5
votes
3answers
155 views

Init action hook running late after PayPal's return url?

I have process_ipn method that runs on init action hook. Looks like it is fired after PayPal returns to merchant. Under this method, I could find out the payment status such as completed, pending, ...
1
vote
2answers
35 views

How to delete taxonomy term when a wordpress user is removed?

i need to Delete wp_terms -> name field when a user is delete . my requirement is admin needs to assign posts to specific users, that is admin need to add a post to user1 ,but user2 should not see ...
0
votes
0answers
26 views

Multisite - each site with it's own set of users

I'm looking for a way to separate user accounts per blog/sub-site. I concocted a plan to hook into login/registration process and append the blog_id to the username and email upon one of these actions....
1
vote
0answers
23 views

error custom php function doesn't exists

I was able to successfully set the default page template for a new page, when there is not yet a defined template to be 'member_home_page.php. This works perfectly on my local environment but when I ...
0
votes
0answers
28 views

Customize plugin templates

I am attempting to make some pretty serious template customizations to some of my plugins (mostly Event Espresso). Obviously I don’t want to touch the core stylesheets and template files, since they’...
1
vote
2answers
23 views

Generating an nonce for Content Security Policy and all scripts - How to make it match/persist for each page load?

Hooking into the script_loader_tag hook and generating random strings is no problem, but how can I generate them once per page load and use them in both wp_head and script_loader_tag? I'd really like ...
2
votes
1answer
27 views

Can I edit the wp_post > post_content right before its inserted/updated?

I would need to apply some sort of encryption on whatever gets inserted in the wp_post > post_content, so I was wondering if there is a way, either modifying the core (rather not), or using some ...
0
votes
0answers
22 views

admin_post_(action) hook create console log error

In latest WordPress if web page has <input type="hidden" name="action" value="action_name"> input field with name=action then it create console log error. But this happen maybe 4.9.5/6. However....
1
vote
2answers
23 views

How To Change The Html of Products filtration sidebar in Woocommerce?

I have Used the function dynamic_sidebar('sidebarId') in the sidebar.php file. and all the functionality of the sidebar is Working succsessfully My Question is How To Change the Html of the sidebar ...
1
vote
0answers
29 views

How to use wp_trash_post (or wp_delete_post) for deleting a (or all) post(s) from custom post type?

I know, my question is general and here is some similar questions, I checked the all, but I dont find any solution for my problem... I try using the wp_trash_post() in my function.php, but for some ...
0
votes
1answer
28 views

Undefined fieldId in gform.addFilter for limiting dates in datepicker - Gravity Forms

I've added support for datepicker on date fields in entry detail edit admin page of Gravity Forms. I did this by simply enqueuing the gform_datepicker_init script in admin_enqueue_scripts hook. This ...
1
vote
1answer
16 views

Hide a specific category in admin All Posts page (Wordpress)

Basically, when I view the All Posts page in Wordpress Admin, I want to filter out all posts from a specific category to now be shown there. After some searching, I found this hook but it's not ...
0
votes
0answers
14 views

Hook/filter WordPress Importer plugin?

I have a large .xml (WXR) export from a historic WordPress site (6,000+ posts). I have installed the WordPress Importer plugin, and I'm able to use it to import the file. Whilst all posts' text gets ...
0
votes
1answer
20 views

Modifying meta tags after doing ajax call in plugin

I have a plugin that will automatically load articles from a news publisher by checking query vars in the URL. If an article was requested, it does an AJAX call to this publisher, creates a new ...
1
vote
1answer
23 views

How to change the order (priority) of registered filters (or actions) (e.g. for the_content)?

Is there any way to change the order of filters for e.g. the_content before they are applied? What I currently have is the following ideas: /** * Print all filters for some hook. */ function ...
0
votes
0answers
35 views

How do I trigger a post update within a get_posts() foreach loop?

I am using plugins that fire action hooks before and after a post save. When a post is saved the functions hooked into those actions perform some calculations and put the results into a custom field. ...
0
votes
0answers
11 views

Correct action to use on Custom Post Type creation with custom status

We have a custom post type with custom statuses. I am trying to hook into the moment that a post is created and updated. The idea is to send an email when the post is created and another email ...
0
votes
1answer
28 views

How to load a template-part based on a url wildcard?

I'm trying to create a agenda in a custom Wordpress theme. On the agenda page there is a simple page-agenda.php template that will include some code that handles the index of the agenda. Quite simple. ...
0
votes
1answer
16 views

How to I prevent WordPress from switching external HTTP links to HTTPS?

The website has an SSL certificate and uses https://, but when I link to a website using a text link pointing to http://domain.com and then preview it the link is updated to https://domain.com. What ...
1
vote
1answer
31 views

How to debug user_register hook

I created this selectbox inside my user-edit.php screen trough edit_user_profile hook. <table class="form-table"> <tbody> <tr> <th> <...
0
votes
1answer
29 views

How to remove a class function from a plugin by using remove_action()?

Result of the var_dump('parse_query'): WP_Hook::__set_state(array( 'callbacks' => array ( 10 => array ( '...
0
votes
1answer
26 views

How does do_action( ) works actually?

I am trying to understand the code of 'Awesome Support' plugin code. I am stuck at the following line: <?php do_action( 'wpas_after_ticket_submit' ); ?> As far I know do_action(); executes ...
2
votes
2answers
24 views

Redirect users on specific post category or category page

im trying to redirect users on specific categry with this hook: // Show app-data posts only to app users function user_redirect() { if ( is_category( 'app-data' ) ) { $url = site_url(); ...
0
votes
1answer
16 views

How to run hooks one by one manually?

Im tracking down slowness issues. This line: do_action( 'init' ); in wp-settings.php takes 4,5 seconds to run alone. Most of plugins are turned off now. Is there a way to run those init() hooks one ...
0
votes
1answer
15 views

With what hook do I remove WooCommerce existing Product Data Tab form fields?

When editing a Woocommerce product in wp-admin there is a Product Data section with vertical tabs each of which has its own form fields to fill out. A plugin has added fields that I don't want to the ...
0
votes
1answer
22 views

Stylesheet is getting removed/deregistered automatically

I've put some custom code in my active child theme's functions.php. I'm trying to enqueue some style on a admin page. However, a style enqueued in admin_enqueue_scripts hook gets automatically removed ...
0
votes
1answer
151 views

how to add custom functionality after woocommerce place order button

I am creating a plugin to send a one time password (OTP) to the user when the place order button is clicked. When the user clicks the button, the number from the phone number field must be captured ...
0
votes
0answers
12 views

How to store additional data that is related to core data

Long story short, I am going to be building a web application with WordPress as the framework. We have to use WordPress, I cannot suggest a different framework. The application will have users with ...
0
votes
0answers
37 views

Displaying woocommerce product attribute

There is a single product page template. And inside there it display all the product details (title, price, attributes, .etc) under this "do_action" code : <?php ...
0
votes
1answer
36 views

How to change a Wordpress term's slug before saving

We are using WP All Import to import product data from a CSV into WooCommerce. Everything works fine (great plugin!) but we have one problem: Two of our product attributes contain disallowed symbols: ...
0
votes
0answers
22 views

What could cause wpmu_create_blog to throw “Already Installed” Error on multisite?

I have a production website https://toursoft.co which when we do dev work we move it to https://toursoft.us and do a database search replace to setup the dev environment. This is a multisite ...
4
votes
2answers
371 views

Edit plugin without hooks in functions.php

<?php namespace wp_gdpr_wc\controller; use wp_gdpr\lib\Gdpr_Language; class Controller_Menu_Page_Wc { const PRIVACY_POLICY_TEXT_WOO_REQUEST = 'gdpr_priv_pov_text_woo_request'; const ...
1
vote
1answer
28 views

Don't insert if permalink is the same?

I have a foreach loop inserting posts. And I already have statements to check if post already exists by unique meta values. But somehow, often when site is loading slowly, something strange happens ...
0
votes
1answer
41 views

remove_action - pre_get_posts - does not restore original query

I have following functions ... function ajax_sortposts() { global $wp_query; $sorting_order = $_POST['sorting_order']; if ( $sorting_order == 'Latest' ) { remove_action( '...
1
vote
1answer
19 views

How can I hook into and edit the text of a wp_nav_menu <a> tag?

I'm trying to change the text displayed for the anchor tags in the wp_nav_menu li's. I actually managed to do this with jQuery, nothing fancy, because I am certainly no professional. You can see the ...
1
vote
3answers
40 views

Deactivate Plugin on Theme Switch

I am developing a plugin, let's call it DahPlugin, that provides additional customizer options for a free theme I developed. Let's call this theme DahTheme (I don't want to shamelessly plug either one ...
4
votes
1answer
188 views

Does WP fire delete_post when trashed posts are automatically deleted?

I have a custom db table that stores additional post data and I need to delete posts from my custom table when the original post is deleted. Will WP fire the delete_post action below and run ...
0
votes
0answers
66 views

How to hook in to WooCommerce Related Products

Have done some searching, but all the solutions to this problem relate to excluding categories and/or tags. How do I hook into woocommerce_get_related_products so I can exclude the following: ...