Questions tagged [wordpress-hook]

Wordpress-Hook refers to the method in which functions or a piece of code interacts/modifies another piece of code in the open-source content management system WordPress, similar to how a plug-in acts as a software component that adds a specific feature to an existing computer program. Use this tag for questions related to this particular way of interacting in Wordpress Core.

Wordpress-Hook refers to the method in which functions or a piece of code interacts/modifies another piece of code in the open-source content management system WordPress, similar to how a plug-in acts as a software component that adds a specific feature to an existing computer program.

Use this tag for questions related to this particular way of interacting in WordPress Core.

208 questions
17
votes
6 answers

Wordpress on Ubuntu install plugins without FTP access

I run my own web server for development and, on it, I installed a WordPress instance. When I try to add plugins to this instance from the admin interface, WordPress asks for FTP access. I don't use FTP and have no plans to do so in the future. I…
Manny Calavera
  • 6,815
  • 20
  • 60
  • 85
13
votes
8 answers

Which WordPress hook fires after save all post data and post meta?

I have a custom post type crm, and i need to send a mail after each crm saved or updated. i user cmb2 for some custom meta like subject, to users etc. I know the save_post hook fires after post save (according to WordPress codex) in my case when i…
M. K Hossain
  • 807
  • 1
  • 12
  • 28
12
votes
3 answers

What is the wordpress hook when I publish a new post, (not when I update a published one)?

I want to send an email any time a new post is FIRST published (not when it is edited) I tried: add_action('publish_post', 'postPublished'); But postPublished is ALSO called when I update an already published post. I just want to get it called…
yarek
  • 11,278
  • 30
  • 120
  • 219
12
votes
4 answers

How to Auto Login After Registration in WordPress with core php

I've been trying for days now to take users who have just registered to my WordPress site and automatically log them in and then redirect them to a URL of my choice. By default, WordPress sends you a username and a password, then you must log in…
10
votes
1 answer

Hook into 'save custom taxonomy' like 'save_post' in WordPress

Is it possible to hook a function when a custom taxonomy term (which is not known beforehand), (preferably custom taxonomy child term) is edited/saved, just like the way we can hook into save_post when a post or page is saved? What I want to do when…
andyderuyter
  • 1,081
  • 2
  • 8
  • 25
9
votes
2 answers

Calling a function on button click, getting a url

I am new to wordpress. I am trying to call function myprefix_edit_user_cb() to get the edit form after user clicks on edit. function getdata() { $blogusers = get_users(); foreach ( $blogusers as $user ) { echo '' .…
Steve
  • 1,622
  • 5
  • 21
  • 39
9
votes
2 answers

WP/WC missing argument in WooCommerce Function

I have Wordpress with WooCommerce installed and I am trying to use this code to login an admin user: if ( !is_user_logged_in() ) { $user = get_userdatabylogin( $username ); // get_user_by('login', $user_login); $id = $user->ID; …
charlie
  • 415
  • 4
  • 35
  • 83
6
votes
1 answer

WordPress Filter for changing author list in edit post Authors box

I want to change the list of users in the Author select dropdown on the edit post page for a custom post type. Is there a filter hook I can use for this? I haven't been able to find any information on a filter hook that does what I want. The hook…
Mike Harrison
  • 1,309
  • 12
  • 17
5
votes
2 answers

Autofill checkout inputs based on custom post type match / query

I have recently come across a problem of which I has me a little confused. Within my WP setup, I have a basic WooCommerce solution, (For the theme I am using the Timber starter theme to make use of twig templating). As well as this, I am using a…
5
votes
1 answer

WordPress: Move inline JS to be fired after deffered jQuery

Trying to follow Google Page Insights suggestions, I've got the "JS render block" recommendation for and it is related to jQuery main file. My site use WordPress with some plugins. One of the plugins throw its JS inline. So when I move jQuery to…
Shir Gans
  • 1,976
  • 3
  • 23
  • 40
5
votes
1 answer

Change WP admin post status filter for custom post type

How do you change/rename the text of post statuses in the top of the WP custom post type page All | Published | Scheduled | Draft
rickyit
  • 243
  • 1
  • 4
  • 7
4
votes
3 answers

How to use add_action to hook a static method from other Class

I tried to use hook to call a static method, but it failed. I add the action in test.php like this require_once('class.test.php'); add_action('register_new_user', array('Test','auto_signin'),20); and my auto_signin function put in class.test.php…
mark
  • 208
  • 1
  • 3
  • 11
4
votes
2 answers

Creating a plugin for WooCommerce: Adding an option tab to API settings

I am creating a plugin for Worpdress/WooCommerce. I have done all the stuff and now I want to add an option tab to woocommerce API settings, like in this instruction tutorial. This is my code: add_filter( 'woocommerce_get_sections_api',…
pwnz22
  • 469
  • 2
  • 9
  • 19
3
votes
1 answer

WordPress & DigitalOcean Managed Database SQL Require Primary Key issue

Context: Not a lot of WP dev knowledge, but experienced PHP developer in general. So, as everyone might know (or not, like I didn't) DigitalOcean's Managed Database system is set to have a required primary key (not globally changeable). While I…
Solid
  • 105
  • 2
  • 15
3
votes
1 answer

WordPress save_post_{custom_post_type} hook after all post meta is saved

Literally the save_post wp hook get triggered before the post meta data is saved. That's why I am facing an issue. Anyone can help me please?
Willie Lee
  • 33
  • 5
1
2 3
13 14