Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

Questions tagged [javascript]

A client side scripting language useful for making interactive web sites. Questions about using JavaScript outside a WordPress context are off-topic but might be asked on Stack Overflow.

Filter by
Sorted by
Tagged with
0 votes
0 answers
9 views

Hook on file upload

I need a hook or some way to detect when the window to select the file to upload is opened. I'm talking about the window that opens the browser to select the local files to upload. Context: On ...
user avatar
  • 15
1 vote
1 answer
25 views

Gutenberg add extra attributes to custom format

I'm creating a custom format (adding a custom option to the format toolbar) using the following guide: https://developer.wordpress.org/block-editor/how-to-guides/format-api/ import { ...
user avatar
  • 281
0 votes
0 answers
21 views

How to async stripe javascript in WP Forms? [closed]

The short question is the title: how can I add "async" to the Stripe JS modules that get loaded through the WPForms Stripe AddOn? Longer explanation: It seems that the Stripe JavaScript is ...
user avatar
0 votes
0 answers
31 views

Using Ajax to submit a form, and run a SQL Select query based on user input from the form

I'm creating a web form on my WordPress powered website. The form is intended to allow the user to enter a ZIP Code (aka postal code). When the user submits the form, the page should query a MySQL ...
user avatar
  • 1
0 votes
1 answer
16 views

Add a class to WooCommerce error message with specific text [closed]

I want to add a class to the WooCommerce error message <li> element which contains specific text. The problem is that when the page loads, this element does not exist, since it only appears when ...
user avatar
  • 101
1 vote
1 answer
16 views

Very simple wordpress block to display posts from an api call

I've been banging my head on this for a bit now. I'm trying to create a simple wordpress block that fetches custom post types from the rest api, then displays the fetched posts via react. It only ...
user avatar
0 votes
0 answers
24 views

Hot to check if new posts have been published since page load and notify online users?

I want to show a div notifying online users that there are new posts since they have accessed the page, in the index and also if new posts have been added in the category or tag they are browsing. I ...
user avatar
0 votes
0 answers
22 views

Dynamically add Js

I have a basic bunch of CSS/Js files defined in my functions.php file. There I register and enqueue those scripts and stylesheets. But in specific situations I want to load additional scripts based on ...
user avatar
2 votes
1 answer
35 views

Javascript code inside "<# #>" in core WordPress files .php

I found some interesting embeding JavaScript mix with HTML in WordPress php files, for instance: <?php // Template for the Attachment Details two columns layout. ?> <script type="text/...
user avatar
0 votes
0 answers
13 views

JS / jQuery in Elementor pages vs JS file

I have a lot of JavaScript and jQuery functions that are all working fine, but it's quite fragmented and hard to maintain as some are in Elementor HTML widgets, others in specific Pho functions annd ...
user avatar
0 votes
0 answers
26 views

How to change text color depending on the number value (Using javascript)

I'm trying to change text on the table depending on the meta value I give (number). if meta value >= 7, number text on table changes to green. else if meta value >= 4, number text on table ...
user avatar
0 votes
1 answer
21 views

Gutenberg Editor: dynamically edit slug field based on ACF field

I'm trying to edit the slug field on the right panel of Gutenberg editor and edit its content based on a custom field. I noticed that I can access to the field by using wp.data.select('core/editor')....
user avatar
0 votes
0 answers
18 views

Additional file upload in Gutenberg page options/featured image

I would like to add an additional image upload in the featured image part of the Gutenberg page options editor. e.g. as in the image below, but with an additional file upload area. In my PHP file I ...
user avatar
0 votes
0 answers
15 views

Script widget works only in admin view but not in Public

Script Widget bug in WordPress. The embed widget from Funda was working before, clueless why it suddenly stopped working. In Public view, it's not working. Preview mode while logged in to WordPress ...
user avatar
  • 1
0 votes
0 answers
27 views

Uncaught TypeError: switchEditors.switchto is not a function

I have the following line of code: switchEditors.switchto(ctmce[0]); which gives this error: Uncaught TypeError: switchEditors.switchto is not a function Searching around I found out that, due to ...
user avatar
  • 101
1 vote
0 answers
43 views

How to disable inline css styles generated by Gutenberg editor?

I've got Genesis-blocks plugin installed (it got updated from Atomic blocks). I am using blocks and resuable blocks to create pages. The problem I am facing is, most of these blocks inject their own ...
user avatar
  • 121
0 votes
0 answers
15 views

Type character in name and make it invisble

my website is using MyHome theme. I need to write identical names for two search fields. Here - https://komand.suvenirite.net/dava-pod-naem/?offer-type=rent And here- https://komand.suvenirite.net/...
user avatar
  • 1
0 votes
0 answers
19 views

Load JavaScript on specific page with @wordpress compiler

I'm new to WordPress development. I have been following a tutorial in Udemy to build my new WordPress website. As recommended by the trainer, it is useful to use npm to package the JavaScripts using &...
user avatar
  • 1
-1 votes
0 answers
25 views

My enqueue javascript dont work?

This is my code in funcions.php wp_register_script( 'revaction', get_template_directory_uri() . '/extensions/revolution.extension.actions.min.js', ['jquery'], false, true ); wp_enqueue_script( '...
user avatar
0 votes
0 answers
59 views

Cannot read properties of undefined (reading 'show_ui') Error on WordPress Post Editor

We're getting the following error on our Block Editor when trying to edit a post: TypeError: Cannot read properties of undefined (reading 'show_ui') at https://informationsecurityleadership.com/wp-...
user avatar
0 votes
0 answers
28 views

Time Delay a URL Redirect for Specific Page

I need to set a time delay redirect for a specific page. Reason is because we have a URL redirect on the specific page and it is not registering for a Google Analytic page visit conversion. So we need ...
user avatar
  • 63
1 vote
0 answers
23 views

Block Editor: Reset Reusable Blocks to last saved record

I’m trying to build my own Block Editor and I would like to reset all blocks to their last saved state by dismissing all unsaved changes when switching from Edit Mode to Preview Mode without reloading ...
user avatar
  • 11
0 votes
2 answers
26 views

How can I get the search form to be selected automatically?

There is an icon to open the search form on my site, and when it is clicked, the search form opens in full screen. I want the search form to be selected automatically, how can I do that? Here: https://...
user avatar
0 votes
0 answers
8 views

Button doesn't work in the profile panel

Can anybody help me out? Currently, I'm having trouble with the Set New Password button in the Profile section of the admin panel. The button is not responsive and nothing happens when clicking. I'm ...
user avatar
  • 1
0 votes
0 answers
21 views

Wordpress Rest Api access the header and extract stylesheets URL

Good morning, i have just started to see in depth the WordPress API and the use of the fetch function in javascript and i would like to know if there is the possibility to get the url of the ...
user avatar
  • 145
2 votes
1 answer
84 views

the Customizer - proper way to instantiate an image upload control via javascript

I am trying to create an image control using: wp.customize.control.add( new wp.customize.Control( myControlSettingID { type: "image", button_labels: {select: 'Select ...
user avatar
  • 148
0 votes
0 answers
17 views

How to store checkbox data for individual users?

I am working on a video-course website and I would like to add a checkbox next to each video so that when a student finishes watching the video, they can mark it complete and when they return they ...
user avatar
1 vote
0 answers
25 views

Populate dropdown with Child Pages based on Parent Page chosen

I'm trying to populate the Child Page dropdown with that of the selected Parent Page - If a specific Parent page is chosen it should fill the second dropdown with all Child pages listed under that ...
user avatar
  • 11
0 votes
0 answers
18 views

Cascading dropdown select search based on Parent Page & Child Page

How would I create a cascading dropdown select search where the first dropdown would host selected Parent Pages and the second to display the Child Pages of the selected Parent. When submit button is ...
user avatar
  • 11
0 votes
1 answer
15 views

How WP does Mortgage affordability calculation

I'm trying to replicate the functionality of how this site: https://www.propertyguru.com.sg/mortgage/affordability-calculator/results I need to understand the logic behind its calculation so i can ...
user avatar
0 votes
0 answers
7 views

WordPress cascading dropdown selection search based on Parent Page & Child Page

How would I create a cascading dropdown select search where the first dropdown would host selected Parent Pages and the second to display the Child Pages of the selected Parent. When submit button is ...
user avatar
  • 11
0 votes
0 answers
17 views

Display WordPress search results based on the selected Sub-Category

I'm trying to create a search using dropdowns in WordPress. I've got two dropdowns, 1 - Parent Category and 1 - Sub-category. The Sub-category will show automatically based on the selected Parent ...
user avatar
  • 11
0 votes
0 answers
11 views

Invert porfolio item order

Hello i'would like to invert the display order of my portfolio. There is no settings for that, i use ot portfolio plugin. Can i use css or js to do such a thing ? Wha would you do ? <div class=&...
user avatar
0 votes
0 answers
14 views

wp.media libary pdf type

What would be library type to show only pdf documents in uploader? wp.media({ library: { type: 'pdf' }, }); I tried 'pdf' and 'application/pdf' but its not working, it shows all media.
user avatar
  • 357
-1 votes
1 answer
51 views

Use callback function in AJAX pure javascript [closed]

I've been looking for a while, but nothing answers my question. How can I turn this code in jQuery into pure javascript? I need it to work for the load more that loads other posts on my WordPress site....
user avatar
0 votes
1 answer
28 views

is_page_template() written in jquery/javascript

With php there is a wordpress function is_page_template() Is there a similar function written in jquery/javascript? To use with the wp.customize api and jquery/javascript.
user avatar
0 votes
0 answers
12 views

Add custom taxonomy using JS in post editor

Very Excited - First Post to SE! I am creating a wordpress app that uses Javascript to call some JSON data and brings it back into the editor. All of that is working great. I can console the data and ...
user avatar
0 votes
0 answers
18 views

Updating failed. The response is not a valid JSON response. specific to my browser when I include javascript in my html

I was able to insert custom html into my gutenberg wordpress editor (hosted by bluehost) and test my code by preview with no problems. I made calls to google maps and fetch() to get a list of ...
user avatar
0 votes
1 answer
64 views

onclick not working since move from HTML to WP

I built a new site using Divi in WP. The previous HTML site had used an onclick event and also included the following script immediately following the opening tag. The digital marketing team ...
user avatar
0 votes
0 answers
31 views

How to set javascript options for select2 in PHP array of plugin

I'm using two different jQuery plugins that I'm trying to get to work together. It should be possible since they come bundled together. The first plugin is the Metabox.io plugin for creating metaboxes....
user avatar
0 votes
1 answer
96 views

create timestamp links to jump to specific times on rumble videos

I am trying to allow visitors to seek specific times on the embed rumble video inside the wordpress post by clicking to timestamp links. I can do it for youtube videos using Skip to Timestamp plugin ...
user avatar
  • 101
0 votes
1 answer
393 views

Uncaught TypeError: Cannot read properties of undefined (reading 'message') [closed]

I wrote authentication for the entry and membership of wordpress. The code I wrote is ajax. not work Validation and redirect. But he gives the following error: Uncaught TypeError: Cannot read ...
user avatar
0 votes
0 answers
34 views

html form: redirect page after form completes submit function and posts data

My form looks like the following, it's inside functions.php <form style="text-align: center;" action="https://website/checkout/" method="POST" onsubmit="return ...
user avatar
0 votes
1 answer
52 views

On click load iframe [closed]

I have this html <a href="#1647278006925-e8321147-313b" data-vc-accordion="" data-vc-container=".vc_tta-container"><span class="vc_tta-title-text">...
user avatar
0 votes
0 answers
14 views

Putting custom html/js page into Elementor as it's own block

I have a working custom html/javascript page that I created and then FTPd into my wordpress site as a custom template which I'm applying to a blank page. However, I have elementor pro and though I may ...
user avatar
  • 113
0 votes
0 answers
33 views

Tracking Visitor LatLng with Wordpress using JS, PHP. How to put data which was extract using JS into DB

Case: I tried to implement via js a geolocation tracker (not an IP Tracker). The code snippet is under Divi > Integration > Body Tag (Divi Page Builder). Afterwars i build via PhpMyAdmin a table ...
user avatar
0 votes
0 answers
82 views

Woocommerce variable product's total amount by javascript

I have a plugin that update the product price depended on selected variation. My problem is that there are two prices that my plugin change just one of them. I want to change the code to update the ...
user avatar
0 votes
2 answers
55 views

Add Paypal button redirect to a specific page after completing

I have created a new page on my WordPress site to test the paypal payment flow. I have subscription based products. Attached code is for the paypal subscription button code. <div id="paypal-...
user avatar
-1 votes
1 answer
15 views

List unused javascript for easy removal

My page speed is suffering from unused javascript. I am using the Perfmatters plugin. IN Perfmatters, you can list the javascript for each page. Is there a list somewhere of what each of these ...
user avatar
0 votes
1 answer
61 views

Multiple jQuery inputs or binds in Customizer Control Javascripts

If I have 2 javascript parts (for the Wordpress customizer), how do I get part_two to have access to use the data entry from part_one? See example below. The part_two script needs access to part_one ...
user avatar

1
2 3 4 5
51