wpdb->insert creates duplicate rows

We had a similar problem here. The reason was that when loading a page in the frontend, WordPress actually was doing two requests: One to load the page A second one in the background after the page was loaded using admin-ajax.php The solution was to make sure, out function was only executed during the “normal” … Read more

Add Action wp_update_post not Updating WYSWIAG editor

Not really sure why this fixed it, but it did: function modify_post_content( $content ) { $screen = get_current_screen(); $post_type = $screen->post_type; if ($post_type == ‘story’){ require_once(‘regex.php’); $response_array = regex($content); $content = $response_array[‘finalString’]; } return $content; } add_filter(‘content_save_pre’, ‘modify_post_content’, 10, 1);

Load actions and filters only for the admin CPT list

The trouble is that this peace of code are ignored and not executed: It is because there is no action with name edit-wt_whoisservers From your code it seems that instead of calling WTRegisterCPTStuff() through an add_action, you can call it directly to load resources for the CPT list. So, the following code //Load stuffs for … Read more

add_action where function has arguments

WordPress core and third-party plugins can trigger events during the execution of their respective code. When you call add_action on um_members_just_after_name, you’re saying: Whenever this um_members_just_after_name action runs, go ahead and run my function my_members_after_user_name, too. That said, $user_id must be supplied by um_members_just_after_name, in other words, if um_members_just_after_name doesn’t exist or doesn’t supply $user_id, … Read more

Translate are not working for standard admin

The only instance of “Count” I can see in the default domain’s admin file has a context value of “Number/count of items”. So your code should be: add_action( ‘admin_init’, ‘action_admin_init’ ); function action_admin_init() { _ex( ‘Count’, ‘Number/count of items’ ); } Ref: _ex.

Best hook for when a user session ends?

There is an auth_cookie_expired hook, but that’s only going to fire if the user visits the site with an expired cookie. Sessions don’t “end” in the way you might be thinking. When users log in they get a session token with an expiration. When that expiration time passes, the token is no longer valid, but … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)