Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
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.
0
votes
List unused javascript for easy removal
I believe you've already used that tool and it told you there was lots of unused javascript. Keep in mind that just because it was unused, doesn't mean it isn't in use. … Fundamentally, the real question is why you have so many javascript files being loaded in the first place. …
1
vote
Accepted
Store JSON in a custom field
Yes! Yes you can!
You can use this code to retrieve a stored option:
$value = get_post_meta($post->ID,'customfieldname',true); // where true means only return 1 custom field by this name
You can u …
8
votes
Accepted
single page wordpress
I would advise you build the site without the AJAX and then add AJAX on top so that everything degrades gracefully should an error occur or if javascript is turned off. …
1
vote
Accepted
Javascript not loading after the document ready
Javascript runs as soon as it's loaded, you need to wait for the DOM ready event, and you do that in JS, not in WP:
jQuery(document).ready(function(){
/* your code here */
}); …
0
votes
Wordpress Javascript displaying an image Question
https://codex.wordpress.org/Javascript_Reference/wp.media
To be able to use the JavaScript-API, you first have to init all the needed JavaScript-Libraries and Styles:
wp_enqueue_media(); …
2
votes
Accepted
WP REST API Post Status Using JavaScript
In this tutorial, the post var status = 'draft'; (see code). So I am just worried that won't anyone able to hack that status?
It depends who it is. A logged out user cannot create any posts at al …
1
vote
Why WordPress not using JSON_UNESCAPED_UNICODE by default?
Because until relatively recently WordPress supported PHP 5.2+, but that constant was only added in PHP 5.4.
Given that wp_json_encode is meant to encapsulate and account for the differing behaviour …
1
vote
Accepted
Gutenberg dependencies in package.json
Yes and no, it depends...
The WP Scripts package depends on the @wordpress/dependency-extraction-webpack-plugin package at:
https://github.com/WordPress/gutenberg/tree/master/packages/dependency-ext …
0
votes
Gutenberg block "This block appears to have been modified externally" on save
This is because your attribute is using the HTML to get its value, and the selector is .button-text, but there is nothing that matches that selector in the saved output.
save({attributes}) {
…
0
votes
Filtering Gutenberg Components, not Blocks
No, you cannot.
You can add extra controls to a blocks toolbar or inspector because filters were added to the code that constructs those user interfaces. Think of it as being handed lego buildings bef …
0
votes
Accepted
download svg to png size image
const w = parseInt(svg.getAttribute('width'));
const h = parseInt(svg.getAttribute('height'));
Change those 2 lines so that w and h have the desired values.
E.g.
const w = 101;
Will make the result …
1
vote
Gutenberg Blocks: how to determine an index of the current inner block?
A save component is intended to save static HTML, and can rely only on the blocks attribute. No interactivity, no local state, no AJAX requests, etc, just block attributes.
If you achieve what you're …
1
vote
How can I import one custom block into another?
You cannot embed blocks as react components this way, and you should not try to use other blocks as user interface components by setting innerblocks with a locked template.
Instead, use 2 filters to m …
0
votes
wp_handle_upload returns a critical error response or invalid form submission
adding-an-endpoint-to-wordpress-rest-api-for-file-uploads/ you may recognise some parts of the error checking
lots more error checking, it should never be triggered but if it does then the REST API will pass it back to your javascript …
21
votes
2
answers
6k
views
Executing Javascript When a Widget is Added in the Backend
I have widgets that have javascript controls attached to them.
If the widget is present when the widget admin page loads, the controls work correctly. … When I add a new widget, they do not work correctly, I get the markup, but no javascript events take effect. …