You have to use the correct handle:
wp_localize_script('page_data', 'glr_dt', $gallery_js_data_array);
// Edit
Your code is also wrong. What do you want to do in this line:
'maxPages' => '$gallery_max_load = $gallery->max_num_pages;'
You are assigning a string to maxPages
.
I guess you want it that way (or similar):
'maxPages' => $gallery->max_num_pages,
Now, you can access the var in your JS as glr_dt.maxPages
Related Posts:
- Update Data parameter of a wp_localize_script() call
- Rate limiting ajax requests in WordPress
- ajaxurl not defined on front end
- How can I configure Docker for developing and deploying a custom theme?
- wp_localize_script $handle
- Custom theme sufficient or custom plugin neccessary for this feature set?
- How to create custom home page via plugin?
- Adding callback function for wp_ajax_ has no effect
- Featured Image not showing in admin
- How Can I setup WP CLI on Windows development machine running AMPPS?
- Are we allowed to use the Allman (BSD) indent style when coding WordPress plugins and themes?
- Customizer: widget-synced triggers twice
- WordPress not working on localhost
- How to localize admin.php only once
- Custom entity search and display
- 400 Bad Request, in wordpress theme development, wp_ajax
- Why in this archive page that call query_posts() function show only the last 10 posts?
- Ajax: Populate with content from a post’s ID not working – duplicating current page html instead
- How to replace settings in WordPress plugin from a theme
- How to remove/replace current page template?
- Setting a post’s category
- Want to know how to reveal a WordPress theme, considering the theme name is hidden?
- Metabox types list
- 400 Bad Request and illegal invocation in wp_ajax based on processData set to false or true
- Ajax Response Error | just getting error as the response
- Determine if the current page, is being edited
- PHP includes with AJAX actions
- Managing Custom Designed Content
- Best practice: What belongs in theme and what in plugin for large eCommerce website
- Adding class to the parent of current-post-ancestor / current-menu-parent / current-post-parent
- Ajax functions – no access to wp-admin.php only online
- Is Explicit Versioning a better alternative to Semantic Versioning for wordpress?
- Is there any other ways to replicating changes on live from staging without pushing from git
- Where to store PHP files created by plugin / themes
- Nonces can be reused multiple times? Bug / Security issue?
- Is there widely accepted phpDoc syntax for documenting which hook calls a function?
- How do I Make a Theme “plugin-ready”?
- How to Add a .js file Only in one specific Page Dynamically to Head
- How to use filter hook ‘post_updated_messages’ in coherence with action hook ‘save_post’
- Plugin Settings not Saving on Ajax re-ordered table
- What is better way to use Bootstrap inside admin panel?
- Timeout on Admin-Ajax?
- What’s the better way to add an inline script?
- Comment `Reply` link doesn’t work if comments are loaded from ajax
- Backslashes being stripped from CSS
- Finding the paragraphs in content
- Order properties should not be accessed directly
- How to avoid loading same script twice?
- Can I individually style items in the backend widget list?
- Finding posts containing matching array elements in a meta field usign WP_Query
- Executing a function upon webhook calling wordpress
- how to use hook deleted_user into custom function to delete user from custom table
- Where to store the name of a custom table?
- include wp-blog-header not working on MAMP
- How to filter users list on user_status field with get_users()
- How can I pass get_the_author_meta(‘user_email’) through the REST API?
- Can Page Templates be Applied to Archive and Post Templates?
- Clearing caches on plugin uninstall
- Is there some way to provide the user a list of existing content in a CPT
- Change the look and feel of admin pages
- how to search users by ajax live search
- What is the proper method of using global $post?
- How to change title tag at page after loaded post?
- WordPress custom taxonomy check box to dropdown
- How to modify files inside wp-includes directory in wordpress
- What exactly do this function declared into functions.php file of a WP theme?
- Create Widget or Enable Shortcodes in Sidebar
- Getting a WordPress Debug Strategy
- Conditional Generation of Image Sizes using add_image_size
- Setting a JSON web token from a secondary api as a secure cookie on WordPress
- WP Still Generating 150×150 Thumbnail Size Even After Un-Setting Small Size in Functions.php
- Does WordPress default CSS have Grids?
- How to resize WordPress images on upload to specific height and width without cropping it
- AJAX request not routing through proxy
- Custom Endpoint – Does it possible to use PUT method with WP API Rest?
- Why won’t this submenu page show? – My First WordPress Plugin
- Pass custom props to
- Include external po file for 3th party plugin to theme
- GET request return value as error instead of success
- ajax stopped working when not logged in wordpress
- ajax response strips multidimensional array and unable to decode
- Using AJAX to submit and return data inside the WordPress Plugin Boiler Plate framework
- $_SESSION inside php function executed by AJAX
- Two same AJAX calls – one is working, other doesn’t
- redirect_to how to make it simply work with get parameter or similar?
- Looping single post in a theme
- WP Ajax on page load not working on bluehost but was working on Godaddy
- Associating special meaning with user id 0
- WordPress permalink setting
- Custom theme and plugin updating
- Dynamic banner for use on external sites
- problem with blank page
- Can’t get query string in ajax call
- grouping my widgets wordpress
- An adiitional function fires on my AJAX submit
- If I want to create new taxonomies (e.g. Project / Documents / Etc…) is it better to create them in the theme’s functions.php or within a plugin? [duplicate]
- How to add something after a function
- How to generate a responsive output from plugin?
- how many rupee or dollar charge to client to make theme [closed]
- Return custom product in ajax call loop