Questions tagged [scripts]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2 votes
1 answer
34 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
14 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
2 answers
29 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/'...
user avatar
0 votes
1 answer
47 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
2 answers
47 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
0 votes
1 answer
30 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 ...
user avatar
1 vote
0 answers
82 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 ...
user avatar
0 votes
0 answers
25 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 ...
user avatar
0 votes
0 answers
112 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 ...
user avatar
0 votes
0 answers
21 views

Integrating a Gutenberg custom block within a larger plugin

I am building a plugin that does many things, one of them being adding a Gutenberg custom block. I am wondering how to structure this. Can I use @wordpress/scripts to bundle the JavaScript or ...
user avatar
0 votes
0 answers
30 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 ...
user avatar
0 votes
1 answer
125 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
user avatar
0 votes
0 answers
103 views

Contact Form 7 Redirect to different URL on form submit depending upon dropdown select

I am using this code for dropdown menu in Contact Form 7: [select* menu-student id:menustudent include_blank "Student" "Professional"] I want if one select Student, then after ...
user avatar
  • 11
0 votes
0 answers
12 views

Create pages from media folders

I am trying to recreate a windows folder structure by using Wordpress pages. In short, on our server there is a folder structure containing about 4800 PDF files that are accessible for viewing by the ...
user avatar
0 votes
1 answer
48 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....
user avatar
  • 1
0 votes
1 answer
31 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 ...
user avatar
0 votes
0 answers
186 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 ...
user avatar
0 votes
0 answers
30 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
  • 11
1 vote
1 answer
53 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 = ...
user avatar
0 votes
0 answers
18 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 ...
user avatar
1 vote
1 answer
472 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: ....
user avatar
0 votes
0 answers
27 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 ...
user avatar
0 votes
1 answer
70 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 ...
user avatar
  • 41
0 votes
1 answer
154 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: <...
user avatar
  • 340
1 vote
1 answer
130 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 ...
user avatar
  • 51.7k
0 votes
0 answers
97 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 ...
user avatar
0 votes
1 answer
300 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 ...
user avatar
  • 1
0 votes
2 answers
175 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 ...
user avatar
  • 101
1 vote
0 answers
391 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 ...
user avatar
  • 63
0 votes
2 answers
59 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 ...
user avatar
  • 3
1 vote
2 answers
40 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 ...
user avatar
0 votes
1 answer
87 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 ...
user avatar
0 votes
1 answer
108 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() ....
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 ...
user avatar
  • 137
0 votes
1 answer
100 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 ...
user avatar
1 vote
2 answers
1k 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 ...
user avatar
  • 111
0 votes
0 answers
48 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: ...
user avatar
  • 193
0 votes
2 answers
516 views

Enqueue Script in custom plugin before other

I've got a conflict with another plugin which is blocking the JS in my custom plugin with the hook: add_action('wp_enqueue_scripts', '<FOREIGN-PLUGIN>'); Is there a way to enqueue my JS before ...
user avatar
0 votes
0 answers
43 views

How to use script in Wordpress installation?

I have a static HTML web page that I would like to recreate on a Wordpress website. The page has a fake survey with a series of questions. Users respond by clicking on one of several buttons which ...
user avatar
0 votes
1 answer
210 views

Unable to defer loading of jquery

I have two render blocking JS from wordpress core. jquery.js and jquery-migrate.min.js. Following this answer on WPSE I was able to add `defer="defer"' to the script tag that calls for jquery-migrate ...
user avatar
  • 139
0 votes
1 answer
35 views

<script turning to <a href once published

I’m trying to add an league table using this script to a WP-page: <script src="https://www.palloliitto.fi/torneopal/ajax/[torneopal:scoretable:competition=splfutsal1920%26amp;class=FL%26amp;group=...
user avatar
  • 1
0 votes
0 answers
711 views

Unload a woff file from Wordpress

I'm trying to improve the speed of my website. However i managed to eliminate all the uncessary file except for this that keeps showing up in Pageinsight (it takes 2.5 sec for the load time). I'm ...
user avatar
1 vote
1 answer
494 views

My scripts-bundle.js file is getting sent to the browser as a stylesheet css file. Help!

I'm new to WordPress custom theme development. I am using a child theme for OceanWP. I have a webpack setup to hot-reload my files but my js scripts are not getting sent to my WordPress site instead ...
user avatar
  • 31
0 votes
1 answer
192 views

Changing URL of scripts, scripts outside theme folder?

Is it possible to have css and js scripts outside of template directory? If it is possible, how can I achieve it? Basically, instead of having: http://example.com/wp-content/themes/mytheme/assets/...
user avatar
  • 141
0 votes
0 answers
750 views

How do I add this OnClick event script to a custom button I’ve created?

I’ll start by saying (and it will probably be obvious) that I’m not very experienced in html or php coding. I’m learning some things as I’m creating this website, but I’m stumped with this one. I’m ...
user avatar
0 votes
0 answers
33 views

Scripts don't enqueue after removing plugin

Using the Ultimate Member plugin. My custom scripts are loading in my child-theme as follows: function some_theme_enqueue_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri() ...
user avatar
  • 109
0 votes
1 answer
24 views

Adding a "code checker" for my e-learning wordpress site

I am currently developing an e-learning platform with wordpress (using learndash) to teach python and I would like my students to be able to submit their python script on the website and get a mark ...
user avatar
1 vote
0 answers
860 views

List All Enqueued Scripts and Styles

Is there any way to list which scripts and styles have been enqueued, while within wp-admin? For example this code works, but only if you are on the frontend. How could I get the same list while ...
user avatar
0 votes
0 answers
325 views

Set Post Thumbnail to external URL

This question is with regard to feature images on WooCommerce product post types, however it should probably apply to any post type. I am running a custom script to create new posts (of type product) ...
user avatar
0 votes
0 answers
26 views

Prevent malicious scripts to be submitted in post

I am building a wordpress backed web application where users will submit posts. Is there any way to prevent malicious codes from being submitted (by way of hooks or filters)?
user avatar
  • 113

1
2 3 4 5