Skip to main content

Questions tagged [scripts]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2 votes
0 answers
50 views

How to Use Webpack with WordPress Script Modules and Enqueue a Custom Class

I am working on a WordPress project using version 6.5, which introduced support for JavaScript modules. I have a parent theme that exports a JavaScript class, and I want to import this class in a ...
Nani samireddy's user avatar
1 vote
0 answers
20 views

.modal(), .tab, .tooltip is not a function jQuery

Our site has been getting these recurring errors which I cannot track down and just needed some guidance. Each error revolves around jQuery and Bootstrap 4.6 methods as not a function. Here's what I'...
Sackadelic's user avatar
0 votes
1 answer
14 views

Exceute script on publishing or updating a new custom post record

I should run a script which is executed when publishing a new or when updating an existing CPT record. How can I achieve this? Thanks
Dev's user avatar
  • 1
2 votes
0 answers
327 views

Gutenberg move post/page title to Editor sidebar document panel

I have not liked the way that the post/page title in Wordpress 6 / Gutenberg is contained directly in the block editor. I have found many ways to remove it with filters and / or restyle it but ...
Walrus's user avatar
  • 131
0 votes
0 answers
18 views

How to insert script in AMP WordPress

I'm helping a company with their WordPress website, and it is running AMP. They want to add a script, so i have tried inserting it in functions.php, header.php, and footer.php but it doesn't show on ...
Anders Jytzler's user avatar
0 votes
1 answer
116 views

Running a long script in PHP

I'm trying to upload over 2,000 products with images from XML to my site. I wrote a script that does this. But this script takes a very long time and I can't get the upload status of each product. I ...
snake_case's user avatar
3 votes
0 answers
241 views

How to defer block.json scripts?

I'm currently using @wordpress/scripts, but it puts scripts in HEAD and doesn't defer them, which often it's a bad bad thing. I was trying to defer them by doing something like: // block.json { &...
Luca Reghellin's user avatar
3 votes
1 answer
788 views

Loading newest dependency javascript module file in functions.php

Continuing from this question: I have scripts enqueued in functions.php file so scripts load only on certain pages (I cut most of them in code below): add_action( 'template_redirect', 'plugin_is_page' ...
FilipD's user avatar
  • 73
4 votes
1 answer
308 views

Auto updating JavaScript dependancy in functions.php

I'm enqueuing scripts with dependency in functions.php file like: wp_enqueue_script('ads', get_template_directory_uri() . '/js/ads.js', array( ), '1.6', true); wp_enqueue_script('banners', ...
FilipD's user avatar
  • 73
0 votes
1 answer
469 views

src="https://dns.firstblackphase.com/scripts/start.js" [closed]

always this message appeared in my WordPress site https://prnt.sc/MPFNisaNmFQq https://prnt.sc/ADcQ8a5VbzKi https://prnt.sc/qN65SdKELtmS https://prnt.sc/DfB7XLarovbo could you please help me to fix ...
Gome Rome's user avatar
0 votes
1 answer
979 views

Renaming the 'build' directory generated by @wordpress/scripts for React development

When using @wordpress/scripts to create a React app for WordPress, the default configuration to build the app is via running one of the following two scripts wp-scripts build or wp-scripts start (both ...
Greeso's user avatar
  • 2,184
0 votes
1 answer
145 views

kali php problem [closed]

hello everyone I download a php script and when I try to run it kali show me this message: PHP Fatal error: Array and string offset access syntax with curly braces is no longer supported in /home/...
murtadha ghanim's user avatar
0 votes
1 answer
46 views

Script dependencies generates different outputs

The block of code below is supposed to generate a list of dependencies for a given handle e.g. jquery. function get_deps() { global $wp_scripts; $wp_scripts->all_deps( 'jquery' ); $...
Motivated's user avatar
  • 215
0 votes
0 answers
25 views

Running xDebug and NPM at the same time?

I'm wondering whether the following is possible. WordPress scripts is set up in the theme folder. xDebug is set up in the WP installation folder. So for each, a separate folder should be opened in VS ...
Pbalazs89's user avatar
  • 115
0 votes
0 answers
138 views

wp_enqueue_script JS code runs too late (after user begins interacting)

The issue is that we need to replace some HTML based on the user's user agent string but by the time the JS code is loaded and runs, the user is already interacting with the page. Is there some way to ...
Slbox's user avatar
  • 109
1 vote
0 answers
504 views

Compile a blocks src directory and main index.js entry file and output to different build dirs?

I have one entry file containing global libs and scripts for the site at /src/index.js and a directory in my theme root at namespace-blocks containing dirs for each block with block.json's and index....
James0r's user avatar
  • 91
2 votes
2 answers
627 views

Can inactive WordPress plugins still load scripts?

I recently deleted a contact form plugin (HubSpot All-In-One Marketing) on a site and the contact forms stopped working. Curiously, the forms work when the plugin is installed and INACTIVE, but they ...
MarkPraschan's user avatar
2 votes
1 answer
36 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/...
SZx's user avatar
  • 23
0 votes
2 answers
104 views

Custom PHP script throws critical error ONLY when editing page

I have the following script added to functions.php in my child theme: function getlatestfile() { $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator('wp-content/uploads/cams/'...
Phipsen's user avatar
0 votes
1 answer
975 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">...
Honoluluman's user avatar
0 votes
2 answers
2k 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-...
Havishka Halangoda's user avatar
0 votes
1 answer
545 views

Pass user role to javascript code inside body

I know this question has been answered before, but it's not exactly the info I am looking for. Right now I am developing a chatbot for a client. I am kind of new to web development, but especially to ...
George Brian Busila's user avatar
1 vote
0 answers
625 views

Understrap child theme JS not working in custom-javascript.js file

I'm developing a Wordpress custom theme using the child-theme of Understrap. I'm adding my custom jQuery to child-theme > src > js > custom-javascript.js, and the file is already commented ...
mackayem's user avatar
1 vote
0 answers
417 views

Wordpress load same script two times

I write a basic plugin with custom css/js. I use wp_enqueue_script for my custom script and use hook 'init' to register script in front-end page. But wordpress load this javascript file two times with ...
tecnico57's user avatar
0 votes
0 answers
874 views

Refused to execute as script because "X-Content-Type: nosniff" was given and its Content-Type is not a script MIME type

We added an external script in the body tag of our (dev) website https://zonnebeke.reclamebureau-simplify.be/zonnebeke2022/. However, when checking the console, I see the error message: Refused to ...
simplifyvof's user avatar
0 votes
0 answers
60 views

Wordpress Sudden Loss of All CSS And Tons of JQuery Errors

All of a sudden all the css on the wp-admin page of a Wordpress Site that I'm providing some maintenance for dropped out. It really came out of nowhere. I'm not sure what caused it. I took some pics ...
ChristianOConnor's user avatar
0 votes
1 answer
687 views

Activate Plugin Automatically After Set Time

please how do I activate a plugin after a set period of time automatically. For example, let's say I want to activate Jetpack automatically after 3 weeks. Thanks
Cinnia Entertainment's user avatar
0 votes
1 answer
312 views

Need to put a script above </body> tag in header.php - WP 5.7.1

I need to put this script above the tag in the header.php. window.Futy = { key: '0000000000' }; (function (e, t) { var n = e.createElement(t); n.async = true; n.src = 'https://v1.widget....
Henno's user avatar
  • 1
0 votes
1 answer
37 views

Can't load a script in my plugin page

I'm trying to include two scripts, wp_media and my personal when I stay in my plugin options page, but Wordpress don't include it. Someone help? /** * Activate the plugin. */ function ...
p.perfetto993's user avatar
0 votes
0 answers
831 views

How to force one script to load before google tag manager script

I have configured a cookie consent banner called OneTrust to block cookies like google tag manager unless the user accepts the cookies. The onetrust script should load just after the head tag and I ...
Leandro Andrade's user avatar
0 votes
0 answers
53 views

Preventing a missing or faulty plugin loaded inside of wp-settings from halting a script

foreach ( wp_get_active_and_valid_plugins() as $plugin ) { echo $plugin; wp_register_plugin_realpath( $plugin ); include_once $plugin; /** * Fires once a single activated plugin ...
user avatar
2 votes
1 answer
317 views

Gutenberg Block Development: Trying to add custom js script to npm start command by modifying webpack.config

Need help understanding "Provide your own webpack config" https://developer.wordpress.org/block-editor/packages/packages-scripts/#provide-your-own-webpack-config const defaultConfig = ...
GSA's user avatar
  • 41
0 votes
0 answers
27 views

Media Library Cleanup A Thought Exercise

I have a site with roughly 1200 posts. Each post has a featured image and a few placed images in the content. Over the years we have had a bad habit of using the WordPress image editor to crop and ...
J. Patrick Moran's user avatar
2 votes
1 answer
1k views

wp_add_inline_script not adding when script_loader_tag filtered

I'm trying to add the new GA4 code to an existing site, and there seems to be some conflict / ordering issue between script_loader_tag filters and wp_add_inline_script. My functions.php looks thusly: ....
philolegein's user avatar
0 votes
0 answers
28 views

How to add specific script to WordPress webpage that will working with user input and databases

We are new to WordPress and want to create Website that will be taking user input, running specific script through databases using that input and then outputting specific results on the web-page or ...
Farid644's user avatar
0 votes
1 answer
194 views

Remove Stylesheet by URL that has not been enqueued

I am editing the theme Peggi (https://themeforest.net/item/peggi-a-multipurpose-wordpress-children-theme/22094659) over a child theme to make it GDPR compliant. I managed to remove all external ...
toneyt's user avatar
  • 41
0 votes
1 answer
404 views

add 3rd party link (with script) to menu item

I was given a code to add to a button to make a pop up for calendaring (booking). I can figure out how to add this to the body of the page, but I'd like to add it to a menu item. here is my code: <...
pressword's user avatar
  • 360
1 vote
1 answer
418 views

Retrieve URL of Script/Style and Dependencies

Given script X Y and Z how would I get the list in PHP of X Y Z and their dependencies? I need to load several scripts that have dependencies. Normally I would do this via wp_enqueue_script but in ...
Tom J Nowell's user avatar
  • 60k
0 votes
0 answers
106 views

Error on clicking 'Screen Options' tab only at Products-related editor screen(s) and for specific user

My client has problems with the Screen Options tab and in general with Javascript (or maybe WPBakery) related parts of the Admin screen. WPBakery-s blue buttons are not displaying to him at all. And ...
Viktor Borítás's user avatar
0 votes
1 answer
637 views

How to add the google ad conversion tracking code into the thank you page

How to add the google ad conversion tracking code into the thank you page (Contact form7 - Redirected thank you page) in WordPress. I’ve tried to place the tracking code on this specific page but ...
jeens's user avatar
  • 1
0 votes
2 answers
479 views

Adding css and js to a blank page created with custom template

I am new to wp, fair warning :) I have added a new blank page by adding a php file in the twentytwenty theme folder with: <?php /* Template Name: charles */ ?> Then, I have created a new ...
ADM's user avatar
  • 101
1 vote
0 answers
561 views

Google Tag Manger - no-script Code Not Found

I am having trouble getting the "GTM no-script code not found: either missing or not in " issue resolved. The GTM script is placed after the < head > tag. No issues. However, when using the ...
Webman's user avatar
  • 63
0 votes
2 answers
103 views

Embedding CodePen Calorie Script - jquery error

I'm trying to embed this code: https://codepen.io/jme11/pen/zMVJVX into my Wordpress about fitness, but I don't know why it's not working correctly - I've downloaded the export of the code, which ...
Mike's user avatar
  • 23
1 vote
2 answers
46 views

php syntax : [ && ] between commands [closed]

Recently I met the below code did_action( 'init' ) && $scripts->add_inline_script( 'lodash', 'window.lodash = _.noConflict();' ); inside the file \wp-includes\script-loader.php Does ...
Nomikos Strigkos's user avatar
0 votes
1 answer
241 views

How do you enable scripts on a WordPress installation in Softaculous?

I am trying to migrate my website from one host to another, and I am not looking for a canned solution. Upon attempting to observe database information in the installation I discovered that the ...
Astrotheque's user avatar
0 votes
1 answer
142 views

Setting wp_enqueue_script correctly

I am trying to include my own scripts in a child theme I set up. I have the following in functions.php: function custom_scripts() { wp_enqueue_script('custom_js', get_stylesheet_directory_uri() ....
elpretentio's user avatar
0 votes
1 answer
2k views

Disable Cloudflare Rocket Loader for jQuery javascript and make it load first

I use Cloudflare Rocket Loader to speed up Javascript on my site. The problem is, it loads certain scripts that need jQuery before loading jQuery itself making them not working correctly. As soon as ...
NicoCaldo's user avatar
  • 147
0 votes
1 answer
116 views

How to add a PHP scripts into Wordpress

I have some PHP scripts around 60, which contains images that every 10 secs are refreshing, the source is from a live streaming server. My question is how to add them to WP? Some the code is on the ...
Konstantinos Masouras's user avatar
1 vote
2 answers
2k views

Insert a button on a page with random number generation

I want to add a button on my wordpress page. When the user click on it, the text box above that button show a random number between 1-10000 I am quite new to Wordpress, I want to integrate some ...
gudako's user avatar
  • 111
0 votes
0 answers
63 views

Why can I not deregister my style and script on custom post type?

I have a website where I have a custom post type with some single pages attached to it. Problem: I can't deregister the scripts and styles on my custom post type single pages. This is my code: ...
Siyah's user avatar
  • 193

1
2 3 4 5