New answers tagged

0

We you want to customise your Error Establishing Database Connection to something else then you need to create a file. Here is the documentation for that https://yoast.com/custom-wordpress-database-error-pages/


0

Although the hooks are passing you the ID of the changed object in the parameter $object_id, you aren't using it and are calling get_the_ID instead which will give you the ID of the current loop item. Try changing your uses of $post_id to $object_id instead.


0

Not really following how the functions relate to each other and where (so what variables are available, how), but you might try something like: add_action('before_test_action', array($this, 'widget_test_func')); public function widget_test_func( $instance) { $boolean = (isset($instance['boolean'])) ? $instance['boolean'] : ''; if ($boolean == 'on'...


0

When call $synchronizationList->display() every thing about table created, pagination,sort and bulk action but when its create bulk action its just create 2 input one is dropbox that contains all of bulk action and a submit button for apply button so it doesn't create from tag and when a submit button doesn't be in a form its do nothing. So i created a ...


1

I have been looking around the core files searching for hooks, there were very few when it comes to hooking into edit_user() function which updates the user data in profile.php page, so I have finished with some workarounds: My workaround is to save the user's password in a custom option before the password was updated, and match later with this user's ...


0

You can use the native PHP sleep() function in WordPress for timers in seconds, or usleep() for timers in microseconds: http://php.net/manual/en/function.sleep.php http://php.net/manual/en/function.usleep.php


0

As of WordPress 3.0.0 this action is available at the top of the new user form: user_new_form_tag As of WordPress 3.7.0 this action is called at the end of the form (right before submit button): user_new_form You will however need to intercept when clicking submit to save any specific user information to the user's meta


1

Since the paste has worked perfect for you, let me turn it into an answer. You can always get the author of a given post with certain methods, let's use get_post_field( 'post_author', $post_id ) for this. To get the data of a given user, there's get_userdata() function to use. We'll pass the author ID as first param to this function to get the author data ...


1

The global $authordata variable is only available by default when $wp_query->is_author() && isset($wp_query->post) condition is satisfied. It means that you can't access $authordata inside a single post page. You may try to get author data via $wp_query: add_action('wp_head', function() { global $wp_query; $userdata = get_userdata(...


0

You can basically deactivate whole plugin only based on the information you have at wordpress "boot" time, which is basically the URL and cookies. Any check more complex then that will probably have to wait until boot is completed to be able to be executed, at which time the plugin is already loaded and it is too late to "deactivate" it.


0

function plugin_script() { wp_enqueue_script( 'Jquery-min', WP_PLUGIN_URL. '/Test Plugin/jquery-min.js', false, '1.11.0' );<br/> wp_enqueue_style('pluginstyle', WP_PLUGIN_URL. '/Test Plugin/pluginstyle.css',false,'1.0',"all");<br/> } add_action( 'wp_head', 'plugin_script' ); The "wp_head" action hook is triggered within the "head" ...


0

Please follow the code: add_action( 'wp_ajax_add_myfunc', 'prefix_ajax_add_myfunc' ); add_action( 'wp_ajax_nopriv_add_myfunc', 'prefix_ajax_add_myfunc' ); function prefix_ajax_add_myfunc() { // Handle request then generate response using WP_Ajax_Response } and in your ajax call do this: jQuery.post( ajaxurl, { 'action': 'add_myfunc',...


0

Please follow the code: add_action( 'wp_ajax_add_myfunc', 'prefix_ajax_add_myfunc' ); add_action( 'wp_ajax_nopriv_add_myfunc', 'prefix_ajax_add_myfunc' ); function prefix_ajax_add_myfunc() { // Handle request then generate response using WP_Ajax_Response } and in your ajax call do this: jQuery.post( ajaxurl, { 'action': 'add_myfunc',...


1

If you want to use a variable from a another context in a function, create a class: class CustomLog { private $debug_msg = ""; public function __construct( $msg ) { $this->debug_msg = $msg; } public function log() { error_log( $this->debug_msg, 0 ); } } add_action( 'init', [ new CustomLog( "Hi there!" ), '...


3

wp_insert_post was introduced in changeset 2887, and was to fix bug #1681. I couldn't find the save_post hook's original provenance, but it was most recently added to core in changeset 3291, related to ticket #2063. Evidently it had existed in 1.5.2 (although version control does not support this theory) and needed to be added back for back-compat. So ...



Top 50 recent answers are included