New answers tagged

1

If you use the _fields argument, then it needs to include id. Otherwise, getEntityRecords() will always return a null, even if the REST API request succeeded. So to fix the issue in question, you just need to add id to your args, i.e. _fields: 'id,name,slug'. You should also know that per_page is limited to 100, so even if you set it to a greater number or ...


1

As @Sally CJ mentioned, you should set a result of str_replace() to a variable. For a content you chose a right filter - the_content, for tinymce editor you need to use the_editor filter. As they a similar, you can use one function for both filters. In my example I use only one str_replace for opening and closing tags. Basically, it will be enough, unless ...


1

NB. As of WP 4.5 it is recommended to use wp_add_inline_script(), rather than wp_localize_script() - the later being intended for localization. See: wp_localize_script() > More Info wp_add_inline_script()


0

The jQuery Migrate Helper fixed it. I’ll troubleshoot which plugin is causing the issue later.


1

The problem in your block is due to the selector value of your emailPlaceholder attribute — you set the value to span.kathyContactFormEmail, but there's actually no span element with that class in your save() function (or the markup/HTML of the element returned by the function). What you have though, is an input with kathyContactFormEmail as the class, so ...


1

You can probably ignore the rule. A (very) quick search revealed the GitHub PR where this rule was added, and it is only intended for use in React components (emphasis mine): It's only meant for React components. Not sure if there's a way to make it more specific...


0

Never mind I found it. let selectEntries = Object.entries(myjson).map( ([k, v]) => ({label: k, value: v}) );


0

I'd reach out directly to that plugin developer to relate your concerns, and if they're not responsive consider a different plugin. But in the meantime, you can use wp_dequeue_script() and wp_dequeue_style() and their counterparts wp_enqueue_script/style to remove the stuff that's slowing down your site. This answer has more detail on how to move scripts ...


0

A simple google search led me to this: You can't run PHP with javascript. JavaScript is a client side technology (runs in the users browser) and PHP is a server side technology (run on the server). If you want to do this you have to make an ajax request to a PHP script and have that return the results you are looking for.


0

This code is my answer: <a href="<?php echo get_author_posts_url( get_the_author_meta('ID'), get_the_author_meta( 'user_nicename' ) ); ?>" class="m-article-author"> <?php $author_bio_avatar_size = apply_filters( 'tierisch_wohnen_author_bio_avatar_size', 49 )...


1

There's no single correct way, but I guess something approaching the normal way would be: Have a package.json file in your theme (or plugin). Install whatever packages you want with npm install, which will install the package into node_modules/ inside your theme. Inside your main script/entrypoint, include that script with require() or import. Configure ...


1

If you are ok to use a plugin for this, I think WP CLient Reports is exactly what you are after. It can create periodical reports for you about plugin, theme or core updates, as well as post/pages updates, etc.


1

Using this link, you will find helpful notes as to how to add a script to your WordPress website. The main idea is to use inbuilt WordPress functions to load your scripts. This is done via the wp_enqueue_script function. Following examples provided in the aforementioned link, you will be able to learn how to enqueue your scripts the safe and secure way! NOTE:...


1

If this is relatively static code treat it as such and put it in a file or template. There are a couple of easy ways of doing this. Via templates Look at the way that WP does it - you have a folder called template-parts - insert your code there and call it in a template type. Assign that page to that template type. Via a file Above you mention this is for a ...


2

You can't. Any secrets you put into your pages or JavaScript can be read out of the downloaded files by the client. Instead, you probably want to either: Move the secrets into your server-side code and have your server code make requests to external APIs using the secrets, and use WordPress nonces and login cookies to authenticate your client scripts to ...


0

Use react-sortable-hoc Draggable is lacking documentation and I did not had the time to dig into it. But the above is for you. I used it to create the sidebar Entry Content/Primary Sidebar control - used to reorder my theme content/sidebar!


1

I suspect that the html block element you're using doesn't handle php, which is why the script tag isn't working the way you hope. wp_localize_script() is a handy function to pass data from PHP to scripts. The function basically does the same thing you were trying to do with the html block. Lets say you're doing this in your theme and you have the following ...


0

I usually make it like that: Go to the child theme create js folder inside child theme create script.js file inside js folder and then paste this code inside script.js file: add_action( 'wp_enqueue_scripts', 'custom_scripts', 10 ); function custom_scripts() { wp_enqueue_script('custom_javascript', get_stylesheet_directory_uri() . '/js/script.js', array(...


Top 50 recent answers are included