I believe you should be able to use this:
global $post;
$page_slug = $post->post_name;
Where $page_slug is the variable you’re looking for. This has a pretty good explanation of why that works: https://blog.wplauncher.com/get-current-page-slug-wordpress/
Related Posts:
- Is it possible to filter the wp_footer() scripts, read the content, and insert them inline?
- Pass a php string to a javascript variable
- wordpress site | All-in-one-cufon IE Issue
- Using window.onload with Ubermenu
- Redirect to another page using contact form 7? [closed]
- wordpress add_action() issue in ajax call
- How do I output user_registered time in my correct timezone?
- force enqueue script to be first in order of prominence
- How to call plugin path in JS?
- Custom plugin giving: wp-admin/admin-ajax.php 400 (Bad Request)
- How can I make content disappear when a user logs in?
- How to save Clicks of a download link button while it doesn’t matter if we refresh the page or again login/logout
- Thumb rating for wordpress – top user
- Check javascript file Proper way in functions.php
- Ajax call doesn’t work in frontend but it’s working in backend (when I’m logged in)
- Add jQuery to WordPress page
- How to use wp-ajax in wp-cron
- How do I use WordPress PHP functions in my Javascript code?
- White text on white background in TinyMCE when wp_editor is called in WP 3.9
- How can I make the “Preview Post” button save and preview in the same window?
- Creating an Exit Confirmation Popup
- Difference between register_block_type & wp.blocks.registerBlockType
- How to create popup same as wordpress popup feature
- jQuery function didn’t work in my plugin
- how to include a simple jquery file into a wordpress plugin
- Problem in loading javascript in footer
- JQuery not working in my plugin [closed]
- add mediaelement.js plugins into WordPress video player control bar
- Shortcode button dosent work for all posts. Work for first post only
- Accessing post’s meta data based on user’s click of a post
- Pulling data from custom plugin settings using PHP shortcode and Javascript
- Notepad sticky plugin
- How do I “get the next 10 posts after post_id == x”?
- Best approach to fetch data from wp options to js file or php file
- Plugin not working & permalink erorr after upgrade to php 7x on Nginx
- Save user total active time after login in wordpress [closed]
- Background Music WP [closed]
- Api external with wordpress
- How to use custom Javascript code inside a plugin?
- Why does my jQuery plugin show up as text in WordPress?
- Adding a simple Javascript file with a plugin
- JQuery needs to be defined in , but Gravity Forms is defining it in the
- Disable submit button order
- Custom meta box with jQuery.sortable custom post type list
- Social share buttons text shows up on post excerpts
- Load CSS files in header of Bones theme?
- JS Plugin not executing the js correctly. Trying to make all internal links scroll smoothly
- Call javascript functions from each page
- Pagination not working
- Javascript from Easy-Fancybox place into footer
- Plugin Admin panel checkbox unchecked after submit
- uncaught TypeError: Cannot read properties of null (reading ‘classList’) custom plugin
- Custom Plugin scripts from admin working in frontend
- Code for unique user visit count on every page WordPress
- Searching a tab/space delimited text file based upon form criteria and returning a ‘record’ into a word press results page
- Ajax call not working in wordpress through a plugin
- Send Array from JS to php file then insert it in wp database through a plugin
- Woo-commerce Update price as a Bulk from My offline software export
- Jquery POST Ajax Return null data in wordpress
- How do I reinit WordPress plugins dynamically using jS?
- WordPress jQuery Post – Amending Variable Value Within Function Command
- how to display recent post by category on home page
- login form should redirect to register page for in 1st login next time it should redirected to home page
- Possible way of having multiple Gutenberg instances for a page?
- How to properly enqueue jQuery knob on WordPress without conflict?
- Ajax Call not Working in Plugin
- Why does my custom plugin only function correctly once per page?
- adding dynamic/multiple slug values in ‘option_none_value’
- Does anybody know how to insert a complete jquery plugin into a wordpress elementor-page?
- JS working when used normally but not in wordpress
- How can I create a secure file download in WordPress?
- front end editor creation for Restropress plug in – displaying information from a WP admin area, on a different URL
- update_post_meta is not working for me when I use e.preventDefault for update button
- Use AJAX to fetch Current Post Thumbnail for WordPress when Uploaded throughMedia Uploader Frontend
- Website always load twice on start
- Problem with wordpress has_action() function
- Multiple image selection custom widget
- Custom Field used to allow a Free Story; no longer works
- Create a form and have custom menu display based on user answers?
- Woocommerce – Change variations output
- How to solve Blocked a frame with origin from accessing a cross origin frame error in wordpress?
- Speeding up WordPress on a Local Network
- How to use information from the database in the front-end?
- Conditional Fields depending on checkboxes
- Custom plugin giving: wp-admin/admin-ajax.php 400 (Bad Request)
- Caching of combined CSS and JS fails because of losing MIME types through combining by PHP
- Help with customising love it plugin (use within foreach)
- Number format in thousands on highcharts in wpdatatable plugin
- Embed Javascript code to registered users only
- show-hide based on select option jquery wordpress
- Javascript in plugin not working
- How to limit each front-end user to view just his own uploaded files on Amazon S3?
- How to create a dashboard for logged-in users with custom functionality? [closed]
- Creating a user ‘add custom field’ section
- Trending Tags based on post views
- Media Playlist Plugin
- AJAX doesn’t pass variables to the php function in the plugin
- How to set up php,javascript and css to allow for our finished product to be displayed within a page?
- What is the process for reimplementing a back up WordPress?
- How do I convince this button to do something when it is clicked?