Username Variable in custom links?

The User data of the currently logged in user in WordPress can be retrieved via wpget_current_user() So you should be able to do something like this in your theme or wherever. $current_user = wp_get_current_user(); echo ‘<a href=”http://example.com/members/’ . $current_user->user_login . ‘/profile”>Your profile</a>.’; And build your link that way. HTH

Ajax object not defined – JS file is in plugin folder

You have registered your JS code in wrong hooks . Always CSS and JS should be registered using wp_enqueue_scripts. Also you have only registered your JS code. You have not enqueued your JS file using wp_enqueue_script( ‘ajax-send-notification-script’ ); function ajax_send_notification_init(){ wp_register_script( ‘ajax-send-notification-script’, plugins_url() . ‘/plugin-name/js/the-plugin.js’, array(‘jquery’) ); wp_localize_script( ‘ajax-send-notification-script’, ‘ajax_send_notification_object’, array( ‘ajaxurl’ => admin_url( ‘admin-ajax.php’ … Read more

Update-safe translating of single text string in plugin

to use the file wp-content/languages/plugins/albdesign-wc-donations-uu_UU.mo in the plugin, it has to be declared like that : load_plugin_textdomain(“albdesign-wc-donations”); // search in wp-content/languages/plugins/ // search in the plugin files if not found in wp-content/languages/plugins/ load_plugin_textdomain(“albdesign-wc-donations”, FALSE, plugin_dir_path(__FILE__) . “languages/”); is it’s not the case, you can create another plugin to correct that loading of the translations files

Add the_post_thumbnail_url to a shortcode in function.php

I think you’re just printing your function as a string, try concatonating: add_action( ‘woocommerce_product_meta_end’, ‘childReview’ ); function childReview() { global $post; echo do_shortcode(‘[cl-popup size=”l” title=”Click!” btn_label=”Headline” btn_bgcolor=”#006982″ btn_color=”#ffffff” overlay_bgcolor=”rgba(0,105,130,0.75)” title_textcolor=”#006982″ content_textcolor=”#006982″]<img src=”https://wordpress.stackexchange.com/questions/235313/” . wp_get_attachment_url ( get_post_thumbnail_id( $post->ID ) ) . ‘”/> [/cl-popup]’); }

wp_localize_script not passing the data

As it stands, your shortcode will be executed after wp_enqueue_scripts — when the post content is output. That’s why the data isn’t available to your scripts during wp_enqueue_scripts for wp_localize_script. wp_enqueue_script( string $handle, string $src = false, array $deps = array(), string|bool|null $ver = false, bool $in_footer = false ) You would; A) Need to … Read more

Redirect logged in user to somepage on every page view?

I would utilize the user meta info and ‘wp’ hook for this. You can use a function similar to below: add_action( ‘wp’, ‘wpse69369_special_thingy’ ); function wpse69369_special_thingy() { if ( is_user_logged_in() && “” == get_user_meta( get_current_user_id(), ‘completioncheck’, true ) ) wp_redirect( string $location ); exit; } } Then when the user completes the action necessary you … Read more

Is there a better way of handling AJAX requests in WordPress?

Use add_rewrite_rule to make your own API and handle the endpoints yourself. Tools like Monkeyman Rewrite Analyzer will help you understand how your rewrite rules end up working with existing rules. if ( ! class_exists( ‘WPSEAPIEndpoint’ ) ): class WPSEAPIEndpoint { // WordPress hooks public function __construct() { add_filter( ‘query_vars’, array ( $this, ‘add_query_vars’ ), … Read more

translate “load more” button

Your link doesn’t embed translation for the “Load more” string. You need to make a modification. If the code is embed in a php file : _e(‘load more’, ‘your_txt_domain’); If the string to translate is in a js file, you need to use wp_localize_script() function.