You can use get_current_user_id() to get the ID of the current user, and in your case, you can do so to print the user ID in the JavaScript Li.re() call:
<script type="text/javascript">
Li.re( 'ab12','<?php echo get_current_user_id(); ?>' );
</script>
And yes, you can include the user ID as part of a shortcode: (note that I omitted the href parameter for simplicity)
<?php echo do_shortcode( '[mycred_link subid1="' . get_current_user_id() . '"][/mycred_link]' ); ?>
PS: Your shortcode was missing the closing ] tag, so I added it above. All shortcode parameter values should also be wrapped in single/double quotes.
Related Posts:
- Is it possible to reuse wp.media.editor Modal for dialogs other than media
- How to provide translations for a WordPress TinyMCE plugin?
- Can I use the wp media uploader for my own plugin?
- How-to implement admin Ajax inside an admin WP_List_Table?
- Customizing the 3.5 “Add Media” popup (Backbone.js)
- Include third party Javascript library which is not included in WordPress
- Hook the Keydown Event in the TinyMCE Post Editor
- lodash dependency in a Gutenberg plugin
- Pass javascript result to shortcode executer function
- The changes I make to an external JS file of my WP plugin are only applied after I clear my browser’s cache
- `wp_set_script_translations` with `wp.i18n` does not return translated strings in simple plugin
- How do I only load js on the post-new.php and post.php pages in admin?
- creating elements/innerblocks via rangecontrol
- How to add quick edit and bulk edit fields to users admin section
- Can’t get JS code to work with shortcode
- How do I add a javascript file to all admin pages via a plugin?
- WordPress admin deleted user details not removed in database. How to delete WordPress Users from Database
- Gutenberg – What is the best way to save/update post meta?
- How to Load Plugin JS in theme’s footer section
- Mixing Regular Javascript With jQuery in a Plugin
- How to run a external JavaScript file on wp-admin if admin, and other if normal user?
- Modify users.php page to create page/post on button clicked
- Where to call wp_enqueue_script in a plugin with custom template?
- Subscribe to author?
- Frontend language per user
- Is there an event or an other method that tells me the preview is loaded?
- WordPress Plugin with a shortcode that dynamically generates javascript. Can I use add_action without wrapping the javascript in a function?
- How to prevent UNDO on guternberg block editor
- Do I have to worry about useState causing a re-render?
- Creating a custom Gutenberg block with columns
- “import declarations may only appear at top level of a module” when importing WooCommerce API node module
- wp.template() returns tags in Ajax response
- Gutenberg: import dependency or assign from global variable?
- My WordPress plugin cannot load my JavaScript file
- add javascript files only when plugin is called?
- What is the proper way to get logged in user id in a plugin?
- How can I avoid conflicts between plugin and theme?
- How to control an elements classes from multiple Gutenberg sidebar controls?
- How should I go about registering JavaScript that isn’t a file? [duplicate]
- How to build a fool proof AdSense revenue sharing model?
- Hide custom post type by user roles
- How to allow only two (or more) users access to a plugin
- Run JavaScript validation script on form submit in plugin
- Custom Plugin – CSS works, JS doesn’t
- Wp-admin Custom User Management
- get author of published post
- Translate javascript with WordPress built-in localization API for static strings
- Associate multiple email addresses with the same user account, so they can log in with either
- Need help about understand api, wp, $ syntax in WordPress plugin script
- How to add a panel/box/widget/are/screen to the right side of edit post/page confusion
- Update a user profile via frontend
- Insert Into Post Not Working For Audio File Using jQuery
- Service Worker Uncaught (in promise) DOMException
- Developing the save function in Gutenberg blocks
- About a programming language starts with [closed]
- Should I put my plugin javascript inline?
- how to get the top 10 popular blogs
- How can I change my assigned user role in WordPress 3.5.1?
- How to relate the Category to user?
- wp.media libary pdf type
- Query String Filtering API
- Getting incorrect filepath inside custom block front-end output using @wordpress/create-block tutorial
- Trigger function on Remove block or add new block in Gutenberg JavaScript
- Multiple TinyMCE on button click is initialized and appended but why only last one is writeable?
- Adding a dropdown on the user admin
- HTMLCollection not counting right in editor? / for loop not working on elements in DOM
- converting a node.js project into a wp plugin
- Is “document loaded” different on admin side than public side?
- Why User_login key doesn’t work with wp_update_user()
- How to use setAttributes outside of the edit function return
- why is apiFetch throwing Unhandled Promise Rejection: TypeError: Object is not a function
- jQueryUI draggable doesn’t work in WordPress plugin
- Load script on frontend from widget plugin
- WordPress with React: Saving and Using Data Collected with fetch
- Append php file to footer
- XMLHttpRequest to open PHP file responds with Missing Page
- How to prevent users from deleting their accounts?
- Using JavaScript in WordPress page to call for server data using AJAX
- Filterable posts using categories
- Add a Script button in W3 Total Cache plugin not working due to conflicting jQuery version
- User Registration Moderate
- Uncaught ReferenceError: kpoejy is not defined
- How to retrieve custom profile fields associated with different users
- Remove from a div by class name from post page if post author role is not administrator
- Upgrade routine: Interaction with user confirmation
- Multiple Users Logged In Causing Incorrect Account Returned
- On one of my sites a file is shown as 404 but the file IS there
- Create Unique and Customized User ID for Website Members in WordPress
- How can i add insertion point between inner blocks in my custom block like core blocks
- How to get the value entered in the input field in wordpres
- How react js and other Javascript Technologies works on WordPress plugin?
- How can create a custom plugin to call my webapi after any registration or membership plugin functionality
- Trouble Importing whatsapp-web.js in a WordPress Plugin Development
- Insert meta-description into Yoast-SEO input-field via JavaScript
- Reinitiate Gutenburg’s blocks using javascript
- how to add contact form 7 shortcode in javascript variable
- Insert text programmatically in WordPress Gutenberg Editor
- Javascript function defined in view.js not reachable from save.js
- How to move custom gutenberg block controls from settings to styles tab?
- How to apply a javascript code on certain parts of elementor made pages?