qid int64 4 8.14M | question stringlengths 20 48.3k | answers list | date stringlengths 10 10 | metadata list | input stringlengths 12 45k | output stringlengths 2 31.8k |
|---|---|---|---|---|---|---|
348,393 | <p>I have created a custom plugin. How do I define its <code>slug</code>?</p>
<p>To clarify, if I attach a custom PHP function to the <a href="https://developer.wordpress.org/reference/hooks/manage_plugins_custom_column/" rel="nofollow noreferrer">manage_plugins_custom_column hook</a>, and in that function print the... | [
{
"answer_id": 348394,
"author": "C0c0b33f",
"author_id": 173627,
"author_profile": "https://wordpress.stackexchange.com/users/173627",
"pm_score": 0,
"selected": false,
"text": "<p>By default, it should be the folder of your plugin.</p>\n\n<p>If you use wp cli, you can use</p>\n\n<pre><... | 2019/09/16 | [
"https://wordpress.stackexchange.com/questions/348393",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/51204/"
] | I have created a custom plugin. How do I define its `slug`?
To clarify, if I attach a custom PHP function to the [manage\_plugins\_custom\_column hook](https://developer.wordpress.org/reference/hooks/manage_plugins_custom_column/), and in that function print the value of the `$plugin_data` array for each plugin in my ... | I eventually submitted this plugin to the WordPress repo. As soon as it was accepted, my plugin was assigned a slug. So it looks like the WordPress plugin admins assign your plugin a slug during the initial review process. |
348,408 | <pre><code>[shortcode]
[shortcode1 title="variable text"] Some text[/shortcode1]
[shortcode1 title="variable text"] Some text[/shortcode1]
[shortcode1 title="variable text"] Some text[/shortcode1]
[shortcode1 title="variable text"] Some text[/shortcode1]
[shortcode1 title="variable text"] Some text[/shortcode... | [
{
"answer_id": 348409,
"author": "WebElaine",
"author_id": 102815,
"author_profile": "https://wordpress.stackexchange.com/users/102815",
"pm_score": 3,
"selected": true,
"text": "<p>Yes, you can include a shortcode however many times you like, inside a shortcode. Just make sure you set u... | 2019/09/16 | [
"https://wordpress.stackexchange.com/questions/348408",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/105791/"
] | ```
[shortcode]
[shortcode1 title="variable text"] Some text[/shortcode1]
[shortcode1 title="variable text"] Some text[/shortcode1]
[shortcode1 title="variable text"] Some text[/shortcode1]
[shortcode1 title="variable text"] Some text[/shortcode1]
[shortcode1 title="variable text"] Some text[/shortcode1]
[s... | Yes, you can include a shortcode however many times you like, inside a shortcode. Just make sure you set up the parent shortcode to parse shortcodes nested within.
So, for example, if your `[shortcode]` does something like
```
function outer_shortcode($content = null) {
return '<div>' . $content . '</div>';
}
``... |
348,473 | <p>How can I logout all users in wordpress at specific time? I tried to create a hook and used WP Control plugin but it did not worked for me</p>
| [
{
"answer_id": 348409,
"author": "WebElaine",
"author_id": 102815,
"author_profile": "https://wordpress.stackexchange.com/users/102815",
"pm_score": 3,
"selected": true,
"text": "<p>Yes, you can include a shortcode however many times you like, inside a shortcode. Just make sure you set u... | 2019/09/17 | [
"https://wordpress.stackexchange.com/questions/348473",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/175288/"
] | How can I logout all users in wordpress at specific time? I tried to create a hook and used WP Control plugin but it did not worked for me | Yes, you can include a shortcode however many times you like, inside a shortcode. Just make sure you set up the parent shortcode to parse shortcodes nested within.
So, for example, if your `[shortcode]` does something like
```
function outer_shortcode($content = null) {
return '<div>' . $content . '</div>';
}
``... |
348,531 | <p>I'd like to make a query of custom posts based on a custom field, say <code>instrument</code>. I need to be able to query only those posts for which the custom field has not been set (i.e. for which the meta value does not exist). Is there a way to achieve this with <code>meta_query</code> ?
Here's the code for the ... | [
{
"answer_id": 348409,
"author": "WebElaine",
"author_id": 102815,
"author_profile": "https://wordpress.stackexchange.com/users/102815",
"pm_score": 3,
"selected": true,
"text": "<p>Yes, you can include a shortcode however many times you like, inside a shortcode. Just make sure you set u... | 2019/09/18 | [
"https://wordpress.stackexchange.com/questions/348531",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/130265/"
] | I'd like to make a query of custom posts based on a custom field, say `instrument`. I need to be able to query only those posts for which the custom field has not been set (i.e. for which the meta value does not exist). Is there a way to achieve this with `meta_query` ?
Here's the code for the query :
```
$args = arra... | Yes, you can include a shortcode however many times you like, inside a shortcode. Just make sure you set up the parent shortcode to parse shortcodes nested within.
So, for example, if your `[shortcode]` does something like
```
function outer_shortcode($content = null) {
return '<div>' . $content . '</div>';
}
``... |
348,559 | <p>In WordPress, I am pulling data in from an api and using custom post types to display in owl-slider. For some reason, my code is breaking the slider layout. I will post the code below.</p>
<pre><code><form>
<section class="s-raking">
<div class="container">
<?php
$ter... | [
{
"answer_id": 348409,
"author": "WebElaine",
"author_id": 102815,
"author_profile": "https://wordpress.stackexchange.com/users/102815",
"pm_score": 3,
"selected": true,
"text": "<p>Yes, you can include a shortcode however many times you like, inside a shortcode. Just make sure you set u... | 2019/09/18 | [
"https://wordpress.stackexchange.com/questions/348559",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/174342/"
] | In WordPress, I am pulling data in from an api and using custom post types to display in owl-slider. For some reason, my code is breaking the slider layout. I will post the code below.
```
<form>
<section class="s-raking">
<div class="container">
<?php
$terms = get_terms( array(
... | Yes, you can include a shortcode however many times you like, inside a shortcode. Just make sure you set up the parent shortcode to parse shortcodes nested within.
So, for example, if your `[shortcode]` does something like
```
function outer_shortcode($content = null) {
return '<div>' . $content . '</div>';
}
``... |
348,593 | <p>Let me first start with; I'm far from a programmer, but I'm getting into it a bit.</p>
<p>Currently I managed to make this loop for a CPT called 'studentensteden'. Now I would love to make it into a shortcode, so I can display this throughout the site if needed.</p>
<p>How would I do this?</p>
<p>I pasted the cod... | [
{
"answer_id": 348409,
"author": "WebElaine",
"author_id": 102815,
"author_profile": "https://wordpress.stackexchange.com/users/102815",
"pm_score": 3,
"selected": true,
"text": "<p>Yes, you can include a shortcode however many times you like, inside a shortcode. Just make sure you set u... | 2019/09/19 | [
"https://wordpress.stackexchange.com/questions/348593",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/175332/"
] | Let me first start with; I'm far from a programmer, but I'm getting into it a bit.
Currently I managed to make this loop for a CPT called 'studentensteden'. Now I would love to make it into a shortcode, so I can display this throughout the site if needed.
How would I do this?
I pasted the code here: <https://pastebi... | Yes, you can include a shortcode however many times you like, inside a shortcode. Just make sure you set up the parent shortcode to parse shortcodes nested within.
So, for example, if your `[shortcode]` does something like
```
function outer_shortcode($content = null) {
return '<div>' . $content . '</div>';
}
``... |
348,607 | <p>I have this MySQL query, which <strong>do</strong> work in PHPMyAdmin:</p>
<pre><code>set @ROW = 0;UPDATE `wp_wpsstm_subtracks` SET `subtrack_order` = @ROW := @ROW+1 WHERE tracklist_id='176226' ORDER BY `subtrack_time` ASC
</code></pre>
<p>I would like to use it within Wordpress:</p>
<pre><code> $querystr = $w... | [
{
"answer_id": 348409,
"author": "WebElaine",
"author_id": 102815,
"author_profile": "https://wordpress.stackexchange.com/users/102815",
"pm_score": 3,
"selected": true,
"text": "<p>Yes, you can include a shortcode however many times you like, inside a shortcode. Just make sure you set u... | 2019/09/19 | [
"https://wordpress.stackexchange.com/questions/348607",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/70449/"
] | I have this MySQL query, which **do** work in PHPMyAdmin:
```
set @ROW = 0;UPDATE `wp_wpsstm_subtracks` SET `subtrack_order` = @ROW := @ROW+1 WHERE tracklist_id='176226' ORDER BY `subtrack_time` ASC
```
I would like to use it within Wordpress:
```
$querystr = $wpdb->prepare("set @ROW = 0;UPDATE `$subtracks_tabl... | Yes, you can include a shortcode however many times you like, inside a shortcode. Just make sure you set up the parent shortcode to parse shortcodes nested within.
So, for example, if your `[shortcode]` does something like
```
function outer_shortcode($content = null) {
return '<div>' . $content . '</div>';
}
``... |
348,609 | <p>I have created a table in my WordPress database. Now, WordPress gets all its data about different posts and pages from the database. This means that WordPress always connects to database automatically without theme developers writing any code.</p>
<p>I want to get information from a table I added to the database in... | [
{
"answer_id": 348612,
"author": "Lee",
"author_id": 47505,
"author_profile": "https://wordpress.stackexchange.com/users/47505",
"pm_score": 0,
"selected": false,
"text": "<p>If you want to make calls to tables inside your Wordpress installation, you should always use the <code>$wpdb</co... | 2019/09/19 | [
"https://wordpress.stackexchange.com/questions/348609",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/161352/"
] | I have created a table in my WordPress database. Now, WordPress gets all its data about different posts and pages from the database. This means that WordPress always connects to database automatically without theme developers writing any code.
I want to get information from a table I added to the database inside the `... | You can (and should) use the existing database connection by accessing `global $wpdb`. The simplest way to use it is with the `get_results()` method:
```
global $wpdb;
$results = $wpdb->get_results( 'SELECT * FROM my_table' );
```
There's other methods available, and things you need to consider like preparing querie... |
348,621 | <p>This is occuring on my local machine, Lubuntu 18.04 with apache2 and Php 7.2.15.</p>
<p>Steps tried:</p>
<ol>
<li>Enable hidden files</li>
</ol>
<p>No .htaccess file seen:</p>
<p><a href="https://nimb.ws/4YJfDT" rel="nofollow noreferrer">https://nimb.ws/4YJfDT</a></p>
<ol start="2">
<li>Switch permalink structu... | [
{
"answer_id": 348612,
"author": "Lee",
"author_id": 47505,
"author_profile": "https://wordpress.stackexchange.com/users/47505",
"pm_score": 0,
"selected": false,
"text": "<p>If you want to make calls to tables inside your Wordpress installation, you should always use the <code>$wpdb</co... | 2019/09/19 | [
"https://wordpress.stackexchange.com/questions/348621",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/165037/"
] | This is occuring on my local machine, Lubuntu 18.04 with apache2 and Php 7.2.15.
Steps tried:
1. Enable hidden files
No .htaccess file seen:
<https://nimb.ws/4YJfDT>
2. Switch permalink structure to attempt to force Wordpress to create new .htaccess file (if missing). Reload file manager.
No change.
<https://nim... | You can (and should) use the existing database connection by accessing `global $wpdb`. The simplest way to use it is with the `get_results()` method:
```
global $wpdb;
$results = $wpdb->get_results( 'SELECT * FROM my_table' );
```
There's other methods available, and things you need to consider like preparing querie... |
348,634 | <p>I have CPT transcript in wordpress website. And create 250 post in CPT transcript.</p>
<p>Now, I want to fetch all transcript data and want to store in another database using rest api url <strong><a href="http://example.com/wp-json/wp/v2/transcript/" rel="nofollow noreferrer">http://example.com/wp-json/wp/v2/transc... | [
{
"answer_id": 348612,
"author": "Lee",
"author_id": 47505,
"author_profile": "https://wordpress.stackexchange.com/users/47505",
"pm_score": 0,
"selected": false,
"text": "<p>If you want to make calls to tables inside your Wordpress installation, you should always use the <code>$wpdb</co... | 2019/09/19 | [
"https://wordpress.stackexchange.com/questions/348634",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/175388/"
] | I have CPT transcript in wordpress website. And create 250 post in CPT transcript.
Now, I want to fetch all transcript data and want to store in another database using rest api url **<http://example.com/wp-json/wp/v2/transcript/>**
AND
HTTP request using CURL
```
$ch = curl_init();
$url = 'http://example.com/wp-js... | You can (and should) use the existing database connection by accessing `global $wpdb`. The simplest way to use it is with the `get_results()` method:
```
global $wpdb;
$results = $wpdb->get_results( 'SELECT * FROM my_table' );
```
There's other methods available, and things you need to consider like preparing querie... |
348,671 | <p>Intro: I'm using a weird plugin called The Events Calendar which vastly operates outside of WP functions. For example, I cannot retrieve custom fields with the WP function.</p>
<p>So essentially, my problem is that I need to update a different post type from the custom content posted in an Events Calendar CPT but I... | [
{
"answer_id": 348673,
"author": "Pat J",
"author_id": 16121,
"author_profile": "https://wordpress.stackexchange.com/users/16121",
"pm_score": 1,
"selected": false,
"text": "<p>The Events Calendar stores the start and end dates as metadata. The keys are <code>_EventStartDate</code> and <... | 2019/09/19 | [
"https://wordpress.stackexchange.com/questions/348671",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/157160/"
] | Intro: I'm using a weird plugin called The Events Calendar which vastly operates outside of WP functions. For example, I cannot retrieve custom fields with the WP function.
So essentially, my problem is that I need to update a different post type from the custom content posted in an Events Calendar CPT but I can only ... | Modern Tribe has presented several articles to address issues like yours.
Please take a look at their article "[Tips for Working With WordPress Actions and Filters](https://theeventscalendar.com/tips-working-wordpress-actions-filters/)" to see if you can track down the `do_action()` or `apply_filters()` statement that... |
348,791 | <p>My client wants to have the ability to call up a common category used in multiple custom post types. So if there is a common category of "budget", then a blog listing would come up with all the custom post types that have a category of "budget".</p>
<p>I read up on a few examples here of using args for different po... | [
{
"answer_id": 348673,
"author": "Pat J",
"author_id": 16121,
"author_profile": "https://wordpress.stackexchange.com/users/16121",
"pm_score": 1,
"selected": false,
"text": "<p>The Events Calendar stores the start and end dates as metadata. The keys are <code>_EventStartDate</code> and <... | 2019/09/21 | [
"https://wordpress.stackexchange.com/questions/348791",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/99384/"
] | My client wants to have the ability to call up a common category used in multiple custom post types. So if there is a common category of "budget", then a blog listing would come up with all the custom post types that have a category of "budget".
I read up on a few examples here of using args for different post types, ... | Modern Tribe has presented several articles to address issues like yours.
Please take a look at their article "[Tips for Working With WordPress Actions and Filters](https://theeventscalendar.com/tips-working-wordpress-actions-filters/)" to see if you can track down the `do_action()` or `apply_filters()` statement that... |
348,836 | <p>I have changed my WordPress site url in wp-config.php by adding this two lines:</p>
<pre><code>define( 'WP_HOME', 'http:// $new url' );
define( 'WP_SITEURL', 'http:// $new url' );
</code></pre>
<p>almost everything working fine, but I have some plugins that still trying to get data from the old url, for example:</... | [
{
"answer_id": 348835,
"author": "cjbj",
"author_id": 75495,
"author_profile": "https://wordpress.stackexchange.com/users/75495",
"pm_score": 1,
"selected": false,
"text": "<p>There's a function called <a href=\"https://developer.wordpress.org/reference/functions/get_category_parents/\" ... | 2019/09/22 | [
"https://wordpress.stackexchange.com/questions/348836",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/175521/"
] | I have changed my WordPress site url in wp-config.php by adding this two lines:
```
define( 'WP_HOME', 'http:// $new url' );
define( 'WP_SITEURL', 'http:// $new url' );
```
almost everything working fine, but I have some plugins that still trying to get data from the old url, for example:
```
https://OLD URL/wp-con... | There's a function called [`get_category_parents`](https://developer.wordpress.org/reference/functions/get_category_parents/) that will return a list of parents based on the ID. You can then loop through this list to display the parents. |
348,927 | <p>I would like to set minimum required size for featured image. I want to prevent using images smaller than the featured image size, because otherwise some images can be displayed improperly.</p>
<p>For example, I set image size</p>
<pre><code>add_image_size('article-retina', 758, 400, true);
</code></pre>
<p>but w... | [
{
"answer_id": 348928,
"author": "Mike Baxter",
"author_id": 38628,
"author_profile": "https://wordpress.stackexchange.com/users/38628",
"pm_score": 1,
"selected": false,
"text": "<p>Add the following to your functions.php file. You can adjust the \"height\" and \"width\" dimensions as ... | 2019/09/23 | [
"https://wordpress.stackexchange.com/questions/348927",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/125792/"
] | I would like to set minimum required size for featured image. I want to prevent using images smaller than the featured image size, because otherwise some images can be displayed improperly.
For example, I set image size
```
add_image_size('article-retina', 758, 400, true);
```
but when I chose as featured image fil... | The best solution I can come up with is a two-parter which adds metadata, then filters the images users are allowed to select from.
If I find a way to update the selector to add an alert, I'll add that as a separate answer.
1st: Add image metadata that will allow us to filter images later
```
add_filter('wp_generat... |
348,951 | <p>Basically: I want my work to be meaningful and efficient. I am considering making my local development AND staging database the same thing.</p>
<p>I would develop on my local machine but have the SQL data stored on a web server. </p>
<p>I could build the site and move the important parts to staging where I can giv... | [
{
"answer_id": 348928,
"author": "Mike Baxter",
"author_id": 38628,
"author_profile": "https://wordpress.stackexchange.com/users/38628",
"pm_score": 1,
"selected": false,
"text": "<p>Add the following to your functions.php file. You can adjust the \"height\" and \"width\" dimensions as ... | 2019/09/24 | [
"https://wordpress.stackexchange.com/questions/348951",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/164729/"
] | Basically: I want my work to be meaningful and efficient. I am considering making my local development AND staging database the same thing.
I would develop on my local machine but have the SQL data stored on a web server.
I could build the site and move the important parts to staging where I can give the client acce... | The best solution I can come up with is a two-parter which adds metadata, then filters the images users are allowed to select from.
If I find a way to update the selector to add an alert, I'll add that as a separate answer.
1st: Add image metadata that will allow us to filter images later
```
add_filter('wp_generat... |
348,981 | <p>I'm trying to fire an admin notice from within a <code>pre_insert_term</code> filter (have also tried it as an action). Example:</p>
<pre class="lang-php prettyprint-override"><code>add_filter( 'pre_insert_term', 'pre_insert_term_action', 10, 2 );
function pre_insert_term_action( $term, $taxonomy ) {
add_actio... | [
{
"answer_id": 349000,
"author": "middlelady",
"author_id": 93927,
"author_profile": "https://wordpress.stackexchange.com/users/93927",
"pm_score": 0,
"selected": false,
"text": "<p>I'd go for something like this:</p>\n\n<pre><code>function my_notices() {\n $screen = get_current_scr... | 2019/09/24 | [
"https://wordpress.stackexchange.com/questions/348981",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/122776/"
] | I'm trying to fire an admin notice from within a `pre_insert_term` filter (have also tried it as an action). Example:
```php
add_filter( 'pre_insert_term', 'pre_insert_term_action', 10, 2 );
function pre_insert_term_action( $term, $taxonomy ) {
add_action( 'admin_notices', 'show_example_error' );
return $term... | So it looks like there is some page redirecting going on in the post updating process, hence why I can't even access a `$GLOBALS` variable. The only alternative I found to use was to use a session variable. Something like:
```
add_filter( 'pre_insert_term', 'pre_insert_term_action', 10, 2 );
add_action( 'admin_notices... |
348,992 | <p>Working on my first decoupled site. Backend is handled by WordPress and lives on the subdomain <code>admin.mydomain.com</code> and the frontend lives at <code>mydomain.com</code>.</p>
<p>The first issue I saw with the headless approach, was that all permalinks referred to <code>admin.mydomain.com</code>. I wanted t... | [
{
"answer_id": 348997,
"author": "INT",
"author_id": 2830,
"author_profile": "https://wordpress.stackexchange.com/users/2830",
"pm_score": 3,
"selected": true,
"text": "<p>My quick and dirty fix looks like this (please note that I use Roots <a href=\"https://roots.io/bedrock/\" rel=\"nof... | 2019/09/24 | [
"https://wordpress.stackexchange.com/questions/348992",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/2830/"
] | Working on my first decoupled site. Backend is handled by WordPress and lives on the subdomain `admin.mydomain.com` and the frontend lives at `mydomain.com`.
The first issue I saw with the headless approach, was that all permalinks referred to `admin.mydomain.com`. I wanted to change that so that the backend reference... | My quick and dirty fix looks like this (please note that I use Roots [Bedrock](https://roots.io/bedrock/), so it differs from a vanilla WP install).
1. In .env add this line `WP_HOME_ADMIN='http://admin.mydomain.test'`
2. In application.php add this line, preferable just after where `WP_HOME` is
defined: `Config::defi... |
349,078 | <p>I am trying to create a simple plugin that creates only one new post. The code I have written creates a the same new post every second. Below is the code I have. What would need to be added so it creates only one post?</p>
<pre><code><?php
/**
*@package blog-poster
*/
/*
Plugin Name: Blog Poster
Plugin URI: http... | [
{
"answer_id": 348997,
"author": "INT",
"author_id": 2830,
"author_profile": "https://wordpress.stackexchange.com/users/2830",
"pm_score": 3,
"selected": true,
"text": "<p>My quick and dirty fix looks like this (please note that I use Roots <a href=\"https://roots.io/bedrock/\" rel=\"nof... | 2019/09/25 | [
"https://wordpress.stackexchange.com/questions/349078",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/175727/"
] | I am trying to create a simple plugin that creates only one new post. The code I have written creates a the same new post every second. Below is the code I have. What would need to be added so it creates only one post?
```
<?php
/**
*@package blog-poster
*/
/*
Plugin Name: Blog Poster
Plugin URI: http://www.litliving.... | My quick and dirty fix looks like this (please note that I use Roots [Bedrock](https://roots.io/bedrock/), so it differs from a vanilla WP install).
1. In .env add this line `WP_HOME_ADMIN='http://admin.mydomain.test'`
2. In application.php add this line, preferable just after where `WP_HOME` is
defined: `Config::defi... |
349,113 | <p>i am trying to give a specific category posts it's own permalink. Followed the steps from this topic (<a href="https://wordpress.stackexchange.com/questions/296699/give-specific-category-its-own-permalink-structure/296703#296703">Give specific category its own permalink structure</a>) but the posts are giving a 404 ... | [
{
"answer_id": 348997,
"author": "INT",
"author_id": 2830,
"author_profile": "https://wordpress.stackexchange.com/users/2830",
"pm_score": 3,
"selected": true,
"text": "<p>My quick and dirty fix looks like this (please note that I use Roots <a href=\"https://roots.io/bedrock/\" rel=\"nof... | 2019/09/26 | [
"https://wordpress.stackexchange.com/questions/349113",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/56503/"
] | i am trying to give a specific category posts it's own permalink. Followed the steps from this topic ([Give specific category its own permalink structure](https://wordpress.stackexchange.com/questions/296699/give-specific-category-its-own-permalink-structure/296703#296703)) but the posts are giving a 404 error.
Cleare... | My quick and dirty fix looks like this (please note that I use Roots [Bedrock](https://roots.io/bedrock/), so it differs from a vanilla WP install).
1. In .env add this line `WP_HOME_ADMIN='http://admin.mydomain.test'`
2. In application.php add this line, preferable just after where `WP_HOME` is
defined: `Config::defi... |
349,121 | <p>I have create custom post(book). In which i have five texonomy categories: CatA, CatB, CatC, CatD, CatE. & i want to show only 3 posts and i want that these posts coming from CatA, CatC, CatD.(One post each these categories.)</p>
<pre><code><?php
$args = array(
'post_type' => 'book',
... | [
{
"answer_id": 349134,
"author": "Ted Stresen-Reuter",
"author_id": 112766,
"author_profile": "https://wordpress.stackexchange.com/users/112766",
"pm_score": 0,
"selected": false,
"text": "<p>You probably need to use a <a href=\"https://developer.wordpress.org/reference/classes/wp_query/... | 2019/09/26 | [
"https://wordpress.stackexchange.com/questions/349121",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/175759/"
] | I have create custom post(book). In which i have five texonomy categories: CatA, CatB, CatC, CatD, CatE. & i want to show only 3 posts and i want that these posts coming from CatA, CatC, CatD.(One post each these categories.)
```
<?php
$args = array(
'post_type' => 'book',
'posts_per_p... | You probably need to use a [taxonomy query](https://developer.wordpress.org/reference/classes/wp_query/#taxonomy-parameters) rather than the `terms` field (I don't see `terms` as a valid parameter on [WordPress's WP\_Query documentation page](https://developer.wordpress.org/reference/classes/wp_query/#taxonomy-paramete... |
349,126 | <p>I want to use WP-API heartbeat to open a connection to two displays and have them reflect what the other is saying with each <code>send</code> and <code>tick</code>.</p>
<p>It used to work when the heartbeat API came out in 3.6 - but now at the latest version it is outputting an error:</p>
<p><code>SyntaxError: JS... | [
{
"answer_id": 352531,
"author": "Ram Ratan Maurya",
"author_id": 24756,
"author_profile": "https://wordpress.stackexchange.com/users/24756",
"pm_score": 3,
"selected": true,
"text": "<p>Not 100% sure if that's the cause but can you try replacing <code>$</code> with <code>jQuery</code>?<... | 2019/09/26 | [
"https://wordpress.stackexchange.com/questions/349126",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17411/"
] | I want to use WP-API heartbeat to open a connection to two displays and have them reflect what the other is saying with each `send` and `tick`.
It used to work when the heartbeat API came out in 3.6 - but now at the latest version it is outputting an error:
`SyntaxError: JSON Parse error: Unexpected identifier "Synta... | Not 100% sure if that's the cause but can you try replacing `$` with `jQuery`?
I remember seeing something like this in the past in a similar case. |
349,133 | <p>I have an issue where I need to change the currency programmatically. I am doing an AJAX call and I have noticed that returned results does not take into account which currency the user has set.</p>
<p>So I am now assigning the currency on the $.ajax call, however, the issue is getting WordPress to change the curre... | [
{
"answer_id": 352531,
"author": "Ram Ratan Maurya",
"author_id": 24756,
"author_profile": "https://wordpress.stackexchange.com/users/24756",
"pm_score": 3,
"selected": true,
"text": "<p>Not 100% sure if that's the cause but can you try replacing <code>$</code> with <code>jQuery</code>?<... | 2019/09/26 | [
"https://wordpress.stackexchange.com/questions/349133",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/50042/"
] | I have an issue where I need to change the currency programmatically. I am doing an AJAX call and I have noticed that returned results does not take into account which currency the user has set.
So I am now assigning the currency on the $.ajax call, however, the issue is getting WordPress to change the currency progra... | Not 100% sure if that's the cause but can you try replacing `$` with `jQuery`?
I remember seeing something like this in the past in a similar case. |
349,169 | <p>I am using theme Twenty Sixteen. I created a menu using categories, and when I click on one and end up on a category page that has a "Category : ..." title. I would like to remove that title so that only posts are displayed.<br>
I found this similar post :
<a href="https://wordpress.stackexchange.com/questions/3077... | [
{
"answer_id": 349177,
"author": "Rayat",
"author_id": 175800,
"author_profile": "https://wordpress.stackexchange.com/users/175800",
"pm_score": 2,
"selected": true,
"text": "<p>That title is coming from <code>archive.php</code> file of TwentySixteen theme.</p>\n\n<p>You can find a <code... | 2019/09/26 | [
"https://wordpress.stackexchange.com/questions/349169",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/175795/"
] | I am using theme Twenty Sixteen. I created a menu using categories, and when I click on one and end up on a category page that has a "Category : ..." title. I would like to remove that title so that only posts are displayed.
I found this similar post :
[Remove "Category Archives: title" at the top of a category pag... | That title is coming from `archive.php` file of TwentySixteen theme.
You can find a `<header>` code section in that file.
What you can do, simply copy the `archive.php` file as `category.php`
and then remove the following code section from `category.php` file:
```
<header class="page-header">
<?php
the_a... |
349,174 | <p>The title might not be 100% spot on, but let me illustrate what I mean:</p>
<p>I have a custom taxonomy (doens't matter if taxonomy of post-type), and ACF fields registered on the taxonomy. It all works fine, but I am wondering if I can display the key/value (e.g. Type: Candle) next to Name, Description, Slug, Coun... | [
{
"answer_id": 349177,
"author": "Rayat",
"author_id": 175800,
"author_profile": "https://wordpress.stackexchange.com/users/175800",
"pm_score": 2,
"selected": true,
"text": "<p>That title is coming from <code>archive.php</code> file of TwentySixteen theme.</p>\n\n<p>You can find a <code... | 2019/09/26 | [
"https://wordpress.stackexchange.com/questions/349174",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/168584/"
] | The title might not be 100% spot on, but let me illustrate what I mean:
I have a custom taxonomy (doens't matter if taxonomy of post-type), and ACF fields registered on the taxonomy. It all works fine, but I am wondering if I can display the key/value (e.g. Type: Candle) next to Name, Description, Slug, Count on the f... | That title is coming from `archive.php` file of TwentySixteen theme.
You can find a `<header>` code section in that file.
What you can do, simply copy the `archive.php` file as `category.php`
and then remove the following code section from `category.php` file:
```
<header class="page-header">
<?php
the_a... |
349,183 | <p>I wrote SQL query to get items ID with 'instock' status, but don't know how to add to SELECT only from specified product category.</p>
<p>My code:</p>
<pre><code>$results = $wpdb->get_col( "
SELECT p.ID
FROM {$wpdb->prefix}posts as p
INNER JOIN {$wpdb->prefix}postmeta as pm ON p.ID = pm.post_i... | [
{
"answer_id": 349177,
"author": "Rayat",
"author_id": 175800,
"author_profile": "https://wordpress.stackexchange.com/users/175800",
"pm_score": 2,
"selected": true,
"text": "<p>That title is coming from <code>archive.php</code> file of TwentySixteen theme.</p>\n\n<p>You can find a <code... | 2019/09/26 | [
"https://wordpress.stackexchange.com/questions/349183",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/175735/"
] | I wrote SQL query to get items ID with 'instock' status, but don't know how to add to SELECT only from specified product category.
My code:
```
$results = $wpdb->get_col( "
SELECT p.ID
FROM {$wpdb->prefix}posts as p
INNER JOIN {$wpdb->prefix}postmeta as pm ON p.ID = pm.post_id
WHERE p.post_type LIKE '... | That title is coming from `archive.php` file of TwentySixteen theme.
You can find a `<header>` code section in that file.
What you can do, simply copy the `archive.php` file as `category.php`
and then remove the following code section from `category.php` file:
```
<header class="page-header">
<?php
the_a... |
349,228 | <p>I'm using Bluehost staging options to upload a wp site that I have made locally to a test server and was wondering if there is a solution to password protect the staging/test site so only the people who employ me can see it.</p>
| [
{
"answer_id": 349177,
"author": "Rayat",
"author_id": 175800,
"author_profile": "https://wordpress.stackexchange.com/users/175800",
"pm_score": 2,
"selected": true,
"text": "<p>That title is coming from <code>archive.php</code> file of TwentySixteen theme.</p>\n\n<p>You can find a <code... | 2019/09/27 | [
"https://wordpress.stackexchange.com/questions/349228",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/155468/"
] | I'm using Bluehost staging options to upload a wp site that I have made locally to a test server and was wondering if there is a solution to password protect the staging/test site so only the people who employ me can see it. | That title is coming from `archive.php` file of TwentySixteen theme.
You can find a `<header>` code section in that file.
What you can do, simply copy the `archive.php` file as `category.php`
and then remove the following code section from `category.php` file:
```
<header class="page-header">
<?php
the_a... |
349,234 | <p>I'm trying to wrap 'some' of the fields of the checkout page in a div and inject some buttons because I am implementing some address validation. </p>
<p>Basically to start with I need a wrapper around company, address line 1, address line 2, town and postcode so I can show/hide them but I can't seem to get anything... | [
{
"answer_id": 349177,
"author": "Rayat",
"author_id": 175800,
"author_profile": "https://wordpress.stackexchange.com/users/175800",
"pm_score": 2,
"selected": true,
"text": "<p>That title is coming from <code>archive.php</code> file of TwentySixteen theme.</p>\n\n<p>You can find a <code... | 2019/09/27 | [
"https://wordpress.stackexchange.com/questions/349234",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/117160/"
] | I'm trying to wrap 'some' of the fields of the checkout page in a div and inject some buttons because I am implementing some address validation.
Basically to start with I need a wrapper around company, address line 1, address line 2, town and postcode so I can show/hide them but I can't seem to get anything to work. ... | That title is coming from `archive.php` file of TwentySixteen theme.
You can find a `<header>` code section in that file.
What you can do, simply copy the `archive.php` file as `category.php`
and then remove the following code section from `category.php` file:
```
<header class="page-header">
<?php
the_a... |
349,249 | <p>I can't manage to disable the URL of only the author's post. Here's an example : <a href="https://i.imgur.com/Iiimo5Q.png" rel="nofollow noreferrer">My website</a></p>
<p>As you can see, the green link is mine (the author of the post). I only want to remove that link, not other comments links. </p>
<p>How can I do... | [
{
"answer_id": 349177,
"author": "Rayat",
"author_id": 175800,
"author_profile": "https://wordpress.stackexchange.com/users/175800",
"pm_score": 2,
"selected": true,
"text": "<p>That title is coming from <code>archive.php</code> file of TwentySixteen theme.</p>\n\n<p>You can find a <code... | 2019/09/27 | [
"https://wordpress.stackexchange.com/questions/349249",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/175856/"
] | I can't manage to disable the URL of only the author's post. Here's an example : [My website](https://i.imgur.com/Iiimo5Q.png)
As you can see, the green link is mine (the author of the post). I only want to remove that link, not other comments links.
How can I do this? I have tried altering this bit of code in funct... | That title is coming from `archive.php` file of TwentySixteen theme.
You can find a `<header>` code section in that file.
What you can do, simply copy the `archive.php` file as `category.php`
and then remove the following code section from `category.php` file:
```
<header class="page-header">
<?php
the_a... |
349,400 | <p>Am trying to set <strong>maximum execution time</strong>, <strong>memory limit</strong>, <strong>max upload</strong> that can be execute by the script. I can do that in php as follows.</p>
<pre><code>ini_set('max_execution_time', '300'); //300 seconds = 5 minutes
ini_set('memory_limit', '64M'); //maximum mb to be... | [
{
"answer_id": 349569,
"author": "chinazaike",
"author_id": 175875,
"author_profile": "https://wordpress.stackexchange.com/users/175875",
"pm_score": -1,
"selected": false,
"text": "<p>The best option that I have was to set the codes below on top of the page of every script that runs my... | 2019/09/30 | [
"https://wordpress.stackexchange.com/questions/349400",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/175875/"
] | Am trying to set **maximum execution time**, **memory limit**, **max upload** that can be execute by the script. I can do that in php as follows.
```
ini_set('max_execution_time', '300'); //300 seconds = 5 minutes
ini_set('memory_limit', '64M'); //maximum mb to be consumed by script
ini_set('upload_max_size', '4M'); /... | Have you tried this?
Add the following to wp-config.php:
set\_time\_limit(300);
Add the following to .htaccess:
php\_value max\_execution\_time 300 |
349,415 | <p>I'm working on <a href="https://afterimagedesigns.com/wp-bootstrap-starter/?dashboard=1" rel="nofollow noreferrer">Wordpress + Bootstrap 4</a> by customising according to the design. The default style.css loads as:</p>
<pre><code><link rel='stylesheet' id='wp-bootstrap-starter-style-css' href='http://localhost/... | [
{
"answer_id": 349418,
"author": "Dallas Price",
"author_id": 103843,
"author_profile": "https://wordpress.stackexchange.com/users/103843",
"pm_score": -1,
"selected": false,
"text": "<p>Change the version number in your style.css file.</p>\n\n<p>Edit: I misunderstood. I think that's the... | 2019/09/30 | [
"https://wordpress.stackexchange.com/questions/349415",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/135113/"
] | I'm working on [Wordpress + Bootstrap 4](https://afterimagedesigns.com/wp-bootstrap-starter/?dashboard=1) by customising according to the design. The default style.css loads as:
```
<link rel='stylesheet' id='wp-bootstrap-starter-style-css' href='http://localhost/hrone/wp-content/themes/theme_name/style.css?ver=5.2.3... | It's using `5.2.3` because no version was specified when `style.css` was enqueued/registered. So it fell back to the version of WordPress.
If you pass in a version when calling `wp_enqueue_style`, it will use that value instead |
349,491 | <p>I am trying to remove the annoying WP Admin bar css.</p>
<pre><code><style type="text/css" media="screen">
html { margin-top: 32px !important; }
* html body { margin-top: 32px !important; }
@media screen and ( max-width: 782px ) {
html { margin-top: 46px !important; }
* html body { margin-top: 46px !i... | [
{
"answer_id": 349494,
"author": "Dallas Price",
"author_id": 103843,
"author_profile": "https://wordpress.stackexchange.com/users/103843",
"pm_score": 1,
"selected": false,
"text": "<p>Good morning!</p>\n\n<p>This filter should work <code>add_filter('show_admin_bar', '__return_false');<... | 2019/10/01 | [
"https://wordpress.stackexchange.com/questions/349491",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/50042/"
] | I am trying to remove the annoying WP Admin bar css.
```
<style type="text/css" media="screen">
html { margin-top: 32px !important; }
* html body { margin-top: 32px !important; }
@media screen and ( max-width: 782px ) {
html { margin-top: 46px !important; }
* html body { margin-top: 46px !important; }
}
</styl... | Good morning!
This filter should work `add_filter('show_admin_bar', '__return_false');` right from the [wordpress codex.](https://codex.wordpress.org/Function_Reference/show_admin_bar)
Alternatively, you can disable it from specific users.[](https://... |
349,499 | <p>I have a template created where I want to call up all post types, but display only those from a common category. The results I'm getting are all normal blog posts and some from one of the custom post types. I have rechecked multiple times and I am using the correct template on my test page. I have cleared the cache.... | [
{
"answer_id": 349649,
"author": "Jess_Pinkman",
"author_id": 171161,
"author_profile": "https://wordpress.stackexchange.com/users/171161",
"pm_score": 1,
"selected": false,
"text": "<ol>\n<li>category_name should take a string, not an array I believe</li>\n<li>post_type is not mentioned... | 2019/10/01 | [
"https://wordpress.stackexchange.com/questions/349499",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/99384/"
] | I have a template created where I want to call up all post types, but display only those from a common category. The results I'm getting are all normal blog posts and some from one of the custom post types. I have rechecked multiple times and I am using the correct template on my test page. I have cleared the cache.
... | 1. category\_name should take a string, not an array I believe
2. post\_type is not mentioned as an arg, and thus defaults to 'post'
so try:
```
$args = array(
'post_type' => 'any', //or use cpt slug as string, or array of strings if multiple
'category_name' => 'budget', //use 'budget,premium' if you ... |
349,550 | <p>I am trying to display WC product images (thumbnails) or just get the url to that image from database. But I can't seem to find the column where the url are stored with the following. One thing I want my query to have is ability to select images of a certain category. I know _wp_attached_file is the meta key and thr... | [
{
"answer_id": 349557,
"author": "Jacob Peattie",
"author_id": 39152,
"author_profile": "https://wordpress.stackexchange.com/users/39152",
"pm_score": 4,
"selected": true,
"text": "<p>The post thumbnail is not stored as a URL. The post thumbnail is stored as the attachment ID in the <cod... | 2019/10/02 | [
"https://wordpress.stackexchange.com/questions/349550",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/174467/"
] | I am trying to display WC product images (thumbnails) or just get the url to that image from database. But I can't seem to find the column where the url are stored with the following. One thing I want my query to have is ability to select images of a certain category. I know \_wp\_attached\_file is the meta key and thr... | The post thumbnail is not stored as a URL. The post thumbnail is stored as the attachment ID in the `_thumbnail_id` post meta. The actual file is stored as the `_wp_attached_file` post meta for that attachment post. WordPress does not store the full URL for attachments in the database. It only stores the path to the fi... |
349,629 | <p>I am having trouble inserting logged-in user data, using the 'user_register' hook. The following code inserts a row in the database, but only inserts the 'email' column. </p>
<pre><code>function nuevoPostulante()
{
global $wpdb;
$tablaPostulante = $wpdb->prefix . 'postulante';
$curren... | [
{
"answer_id": 350084,
"author": "middlelady",
"author_id": 93927,
"author_profile": "https://wordpress.stackexchange.com/users/93927",
"pm_score": 3,
"selected": false,
"text": "<p>General speaking <em>yes</em> for read-only applications (until MySQL 5.7, it's deprecated since version 8... | 2019/10/02 | [
"https://wordpress.stackexchange.com/questions/349629",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/176150/"
] | I am having trouble inserting logged-in user data, using the 'user\_register' hook. The following code inserts a row in the database, but only inserts the 'email' column.
```
function nuevoPostulante()
{
global $wpdb;
$tablaPostulante = $wpdb->prefix . 'postulante';
$current_user = wp_get_... | General speaking *yes* for read-only applications (until MySQL 5.7, it's deprecated since version 8.0), it enables equal `SELECT`s to return data extremely fast if *identical calls* are already stored in cache. You should consider that:
* Only exact same clauses can benefit from the cache engine (no spaces, no comment... |
349,703 | <p>I've made a Gutenberg block which is only appropriate to show on hierarchical post types, so I want to disable it from the block inserter for non-hierarchical post types.</p>
<p>I thought about how to achieve this in PHP, but the <a href="https://developer.wordpress.org/block-editor/tutorials/block-tutorial/writing... | [
{
"answer_id": 349706,
"author": "WebElaine",
"author_id": 102815,
"author_profile": "https://wordpress.stackexchange.com/users/102815",
"pm_score": 3,
"selected": false,
"text": "<p>You can use the <code>allowed_block_types</code> hook:</p>\n\n<pre><code><?php\nfunction wpse_allowed_... | 2019/10/03 | [
"https://wordpress.stackexchange.com/questions/349703",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/138112/"
] | I've made a Gutenberg block which is only appropriate to show on hierarchical post types, so I want to disable it from the block inserter for non-hierarchical post types.
I thought about how to achieve this in PHP, but the [WordPress documentation on registering blocks](https://developer.wordpress.org/block-editor/tut... | You can use the `allowed_block_types` hook:
```
<?php
function wpse_allowed_block_types($allowed_block_types, $post) {
// Limit blocks in 'post' post type
if($post->post_type == 'post') {
// Return an array containing the allowed block types
return array(
'core/paragraph',
... |
349,730 | <p>I have created a custom metabox with an image uploader that will upload multiple images into a gallery that I can then query. It all works accept for the fact that the images don't show as attached to the post in the media library. They are showing as unattached. Any ideas folks?</p>
<pre><code><?php
// Add the ... | [
{
"answer_id": 349706,
"author": "WebElaine",
"author_id": 102815,
"author_profile": "https://wordpress.stackexchange.com/users/102815",
"pm_score": 3,
"selected": false,
"text": "<p>You can use the <code>allowed_block_types</code> hook:</p>\n\n<pre><code><?php\nfunction wpse_allowed_... | 2019/10/04 | [
"https://wordpress.stackexchange.com/questions/349730",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/81422/"
] | I have created a custom metabox with an image uploader that will upload multiple images into a gallery that I can then query. It all works accept for the fact that the images don't show as attached to the post in the media library. They are showing as unattached. Any ideas folks?
```
<?php
// Add the Meta Box
function... | You can use the `allowed_block_types` hook:
```
<?php
function wpse_allowed_block_types($allowed_block_types, $post) {
// Limit blocks in 'post' post type
if($post->post_type == 'post') {
// Return an array containing the allowed block types
return array(
'core/paragraph',
... |
349,743 | <p>I have a page created in wordpress that I want to redirect all users to. Ex.: www.mywordpress.com/offline</p>
<p>How can I direct all traffic requests (except wp-admin and dashboard) to this page?</p>
<p>My goal is to have an offline page for when I am working on things or I am not accepting any new business.</p>
| [
{
"answer_id": 349706,
"author": "WebElaine",
"author_id": 102815,
"author_profile": "https://wordpress.stackexchange.com/users/102815",
"pm_score": 3,
"selected": false,
"text": "<p>You can use the <code>allowed_block_types</code> hook:</p>\n\n<pre><code><?php\nfunction wpse_allowed_... | 2019/10/04 | [
"https://wordpress.stackexchange.com/questions/349743",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/176241/"
] | I have a page created in wordpress that I want to redirect all users to. Ex.: www.mywordpress.com/offline
How can I direct all traffic requests (except wp-admin and dashboard) to this page?
My goal is to have an offline page for when I am working on things or I am not accepting any new business. | You can use the `allowed_block_types` hook:
```
<?php
function wpse_allowed_block_types($allowed_block_types, $post) {
// Limit blocks in 'post' post type
if($post->post_type == 'post') {
// Return an array containing the allowed block types
return array(
'core/paragraph',
... |
349,790 | <p>Is there a way to disable JUST the Code editor view in the content editor?</p>
<p>I have a bunch of clients who fancy themselves developers and keep messing up their own pages because they really have no idea what they're doing. They manage their own content so I can't shut down their editing capabilities entirely,... | [
{
"answer_id": 349799,
"author": "WebElaine",
"author_id": 102815,
"author_profile": "https://wordpress.stackexchange.com/users/102815",
"pm_score": 2,
"selected": false,
"text": "<p>You can do it in JavaScript, though the downside is you have to do it block by block.</p>\n\n<p>You'll ne... | 2019/10/04 | [
"https://wordpress.stackexchange.com/questions/349790",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/98463/"
] | Is there a way to disable JUST the Code editor view in the content editor?
I have a bunch of clients who fancy themselves developers and keep messing up their own pages because they really have no idea what they're doing. They manage their own content so I can't shut down their editing capabilities entirely, but that'... | You can do it in JavaScript, though the downside is you have to do it block by block.
You'll need webpack set up with lodash installed:
```
function removeHtmlEditing( settings, name ) {
return lodash.assign( {}, settings, {
supports: lodash.assign( {}, settings.supports, {
html: false
... |
349,792 | <p>I used this hook to replace the exit address .
Now, unfortunately, this hook does not work and I can not understand why</p>
<pre><code>add_filter('logout_url', 'my_custom_logout_url');
function my_custom_logout_url($force_reauth, $redirect=null){
$logout_url = wp_nonce_url(site_url('logout.php')."?a... | [
{
"answer_id": 349793,
"author": "Gendrith",
"author_id": 162581,
"author_profile": "https://wordpress.stackexchange.com/users/162581",
"pm_score": 0,
"selected": false,
"text": "<p>I created a page named \"<strong>log-out</strong>\"</p>\n\n<p>And then, in page-log-out.php I added this (... | 2019/10/04 | [
"https://wordpress.stackexchange.com/questions/349792",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/151699/"
] | I used this hook to replace the exit address .
Now, unfortunately, this hook does not work and I can not understand why
```
add_filter('logout_url', 'my_custom_logout_url');
function my_custom_logout_url($force_reauth, $redirect=null){
$logout_url = wp_nonce_url(site_url('logout.php')."?action=logout",... | There's *no need to regenerate the logout URL* (the `$logout_url` part in your code) because the first parameter passed to your function is already the logout URL.
So basically, just rename that `$force_reauth` to `$logout_url` and remove the `$logout_url = wp_nonce_url( ... );`:
```php
function my_custom_logout_url(... |
349,802 | <p>This is a very basic question. I am using Serverpress for local development.I have been trying to create a dynamic dropdown.I did some reading and I found an example html,php and jquery script that suits my requirement. The php code is stores n a fike and the jquery calls it using load function. I am not sure where ... | [
{
"answer_id": 349793,
"author": "Gendrith",
"author_id": 162581,
"author_profile": "https://wordpress.stackexchange.com/users/162581",
"pm_score": 0,
"selected": false,
"text": "<p>I created a page named \"<strong>log-out</strong>\"</p>\n\n<p>And then, in page-log-out.php I added this (... | 2019/10/04 | [
"https://wordpress.stackexchange.com/questions/349802",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/176284/"
] | This is a very basic question. I am using Serverpress for local development.I have been trying to create a dynamic dropdown.I did some reading and I found an example html,php and jquery script that suits my requirement. The php code is stores n a fike and the jquery calls it using load function. I am not sure where to ... | There's *no need to regenerate the logout URL* (the `$logout_url` part in your code) because the first parameter passed to your function is already the logout URL.
So basically, just rename that `$force_reauth` to `$logout_url` and remove the `$logout_url = wp_nonce_url( ... );`:
```php
function my_custom_logout_url(... |
349,861 | <p>I am trying to load the CodeMirror editor to be used in a plugin backend. Some textareas are for HTML and some are for CSS. I am quite new to WP development, so pardon my ignorance, but doing this:</p>
<pre class="lang-php prettyprint-override"><code> add_action('admin_enqueue_scripts', 'joermo_enqueue_scripts')... | [
{
"answer_id": 357048,
"author": "Aaron Fisher",
"author_id": 181518,
"author_profile": "https://wordpress.stackexchange.com/users/181518",
"pm_score": 1,
"selected": false,
"text": "<p>I just ran into this exact issue and with a tiny bit of tweaking it should work, what you have is 90% ... | 2019/10/06 | [
"https://wordpress.stackexchange.com/questions/349861",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/176340/"
] | I am trying to load the CodeMirror editor to be used in a plugin backend. Some textareas are for HTML and some are for CSS. I am quite new to WP development, so pardon my ignorance, but doing this:
```php
add_action('admin_enqueue_scripts', 'joermo_enqueue_scripts');
function joermo_enqueue_scripts($hook) {
... | I just ran into this exact issue and with a tiny bit of tweaking it should work, what you have is 90% of the way there.
I've tweaked your code slightly so it should now work.
**The PHP:**
```
add_action('admin_enqueue_scripts', 'joermo_enqueue_scripts');
function joermo_enqueue_scripts($hook) {
$joermo_code['ce... |
349,871 | <p>I am using this code to display social media share links at the top of my posts. Currently, they display fine on my pages and posts. Is there any way to get this to display also on my category pages? Another option that would work is getting the code to display everywhere below the H1 and content, I don't think ther... | [
{
"answer_id": 357048,
"author": "Aaron Fisher",
"author_id": 181518,
"author_profile": "https://wordpress.stackexchange.com/users/181518",
"pm_score": 1,
"selected": false,
"text": "<p>I just ran into this exact issue and with a tiny bit of tweaking it should work, what you have is 90% ... | 2019/10/06 | [
"https://wordpress.stackexchange.com/questions/349871",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/115230/"
] | I am using this code to display social media share links at the top of my posts. Currently, they display fine on my pages and posts. Is there any way to get this to display also on my category pages? Another option that would work is getting the code to display everywhere below the H1 and content, I don't think there a... | I just ran into this exact issue and with a tiny bit of tweaking it should work, what you have is 90% of the way there.
I've tweaked your code slightly so it should now work.
**The PHP:**
```
add_action('admin_enqueue_scripts', 'joermo_enqueue_scripts');
function joermo_enqueue_scripts($hook) {
$joermo_code['ce... |
349,923 | <p>I want to add CSS code to the header of all the posts by a particular author.</p>
<p>I tried the following solution:</p>
<pre><code>function hide_author_box() {
if (is_author('ritesh')) {
?>
<style>
.author-box {
display: none;
}
</style>
<?php
}
}
</code></pre>
<p>Bu... | [
{
"answer_id": 357048,
"author": "Aaron Fisher",
"author_id": 181518,
"author_profile": "https://wordpress.stackexchange.com/users/181518",
"pm_score": 1,
"selected": false,
"text": "<p>I just ran into this exact issue and with a tiny bit of tweaking it should work, what you have is 90% ... | 2019/10/07 | [
"https://wordpress.stackexchange.com/questions/349923",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/145480/"
] | I want to add CSS code to the header of all the posts by a particular author.
I tried the following solution:
```
function hide_author_box() {
if (is_author('ritesh')) {
?>
<style>
.author-box {
display: none;
}
</style>
<?php
}
}
```
But it doesn't work. How do I fix it? | I just ran into this exact issue and with a tiny bit of tweaking it should work, what you have is 90% of the way there.
I've tweaked your code slightly so it should now work.
**The PHP:**
```
add_action('admin_enqueue_scripts', 'joermo_enqueue_scripts');
function joermo_enqueue_scripts($hook) {
$joermo_code['ce... |
349,937 | <p>When trying to edit a user, error 502 appears. An error appears when editing a some part of users, but I do not see patterns.</p>
| [
{
"answer_id": 357048,
"author": "Aaron Fisher",
"author_id": 181518,
"author_profile": "https://wordpress.stackexchange.com/users/181518",
"pm_score": 1,
"selected": false,
"text": "<p>I just ran into this exact issue and with a tiny bit of tweaking it should work, what you have is 90% ... | 2019/10/07 | [
"https://wordpress.stackexchange.com/questions/349937",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/151699/"
] | When trying to edit a user, error 502 appears. An error appears when editing a some part of users, but I do not see patterns. | I just ran into this exact issue and with a tiny bit of tweaking it should work, what you have is 90% of the way there.
I've tweaked your code slightly so it should now work.
**The PHP:**
```
add_action('admin_enqueue_scripts', 'joermo_enqueue_scripts');
function joermo_enqueue_scripts($hook) {
$joermo_code['ce... |
349,940 | <p>I'm trying to customize the <code>save</code> feature of a Wordpress theme, unfortunately I doesn't have the necessary knowledge on this so I need a bit help to do this in the right way.</p>
<p>Essentially the theme that I bought allow me to create a <code>property</code>, the <code>property</code> is stored in the... | [
{
"answer_id": 349942,
"author": "WebElaine",
"author_id": 102815,
"author_profile": "https://wordpress.stackexchange.com/users/102815",
"pm_score": 3,
"selected": true,
"text": "<p>WordPress fires a number of different hooks when a post is (published / updated / saved). It's usually bes... | 2019/10/07 | [
"https://wordpress.stackexchange.com/questions/349940",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/160916/"
] | I'm trying to customize the `save` feature of a Wordpress theme, unfortunately I doesn't have the necessary knowledge on this so I need a bit help to do this in the right way.
Essentially the theme that I bought allow me to create a `property`, the `property` is stored in the `post` table as a normal post, but contain... | WordPress fires a number of different hooks when a post is (published / updated / saved). It's usually best to browse through the Codex to determine which hook fires when, and only when, you want to run your custom code. It's important to be aware that some of these hooks fire multiple times when you click a single but... |
349,961 | <p>I am trying to get the loop to show only two tag that have the ID 53 and 52.
the code without the "if is_tag( array( 53, 52 ) ){" works. I tried different thing but I can't get it to work.</p>
<p>Thank you in advance your your help.</p>
<pre><code><?php
if is_tag( array( 53, 52 ) ){
while ( $projects->... | [
{
"answer_id": 349965,
"author": "Forzr",
"author_id": 176417,
"author_profile": "https://wordpress.stackexchange.com/users/176417",
"pm_score": -1,
"selected": false,
"text": "<p>You can set a query only for specified tags:</p>\n\n<pre><code>$query = new WP_Query( 'tag_id=52,53' );\n\n/... | 2019/10/07 | [
"https://wordpress.stackexchange.com/questions/349961",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/45750/"
] | I am trying to get the loop to show only two tag that have the ID 53 and 52.
the code without the "if is\_tag( array( 53, 52 ) ){" works. I tried different thing but I can't get it to work.
Thank you in advance your your help.
```
<?php
if is_tag( array( 53, 52 ) ){
while ( $projects->have_posts() ) { $projects... | Here are two alternative for you based on your actual query. If you're querying $projects->have\_posts() on WP default blog (Post) you can use query like
```
$projects = new WP_Query( array( 'tag__in' => array( 52, 53 ) ) );
```
Another is if you're querying on Custom Post Type you can use following query to get po... |
350,002 | <p>I have my wordpress site. Which has the normal "post" and a custom post type "download", I Currently use IFTTT, (If This Then That Service) to post my wordpress posts to Twitter.</p>
<p>The IFTTT recipe works perfectly for my posts, and tweets as soon as I publish any post. You can check my site <a href="https://mi... | [
{
"answer_id": 350039,
"author": "maheshwaghmare",
"author_id": 52167,
"author_profile": "https://wordpress.stackexchange.com/users/52167",
"pm_score": 0,
"selected": false,
"text": "<p>This is the off topic question. But the answer is yes it is possible.</p>\n\n<p>In IFTTT we can use th... | 2019/10/08 | [
"https://wordpress.stackexchange.com/questions/350002",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/166927/"
] | I have my wordpress site. Which has the normal "post" and a custom post type "download", I Currently use IFTTT, (If This Then That Service) to post my wordpress posts to Twitter.
The IFTTT recipe works perfectly for my posts, and tweets as soon as I publish any post. You can check my site <https://milyin.com>, and my ... | IFTTT works from RSS feed, simply including your post in wordpress RSS feed can do the trick...
```
function add_cpt_to_loop_and_feed( $query ) {
if ( is_home() && $query->is_main_query() || is_feed() )
$query->set( 'post_type', array( 'post', 'download' ) );
return $query;
}
``` |
350,008 | <p>I've been using staging sites for years. So I'm not asking about the necessary difference to setup a working staging site such as <a href="https://developer.wordpress.org/cli/commands/search-replace/" rel="nofollow noreferrer">search replacing</a> URLs, dev version control branches, changing table prefixes etc.</p>
... | [
{
"answer_id": 350039,
"author": "maheshwaghmare",
"author_id": 52167,
"author_profile": "https://wordpress.stackexchange.com/users/52167",
"pm_score": 0,
"selected": false,
"text": "<p>This is the off topic question. But the answer is yes it is possible.</p>\n\n<p>In IFTTT we can use th... | 2019/10/08 | [
"https://wordpress.stackexchange.com/questions/350008",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/58884/"
] | I've been using staging sites for years. So I'm not asking about the necessary difference to setup a working staging site such as [search replacing](https://developer.wordpress.org/cli/commands/search-replace/) URLs, dev version control branches, changing table prefixes etc.
I'm asking for differences which improve se... | IFTTT works from RSS feed, simply including your post in wordpress RSS feed can do the trick...
```
function add_cpt_to_loop_and_feed( $query ) {
if ( is_home() && $query->is_main_query() || is_feed() )
$query->set( 'post_type', array( 'post', 'download' ) );
return $query;
}
``` |
350,019 | <p>I used this <a href="https://wordpress.org/plugins/mailchimp-wp/" rel="nofollow noreferrer">https://wordpress.org/plugins/mailchimp-wp/</a> plugin to add an opt-in form on every page. Now I want to disable a page to auto-insert this form and make a landing page. I'll use a different opt-in form for that landing page... | [
{
"answer_id": 350039,
"author": "maheshwaghmare",
"author_id": 52167,
"author_profile": "https://wordpress.stackexchange.com/users/52167",
"pm_score": 0,
"selected": false,
"text": "<p>This is the off topic question. But the answer is yes it is possible.</p>\n\n<p>In IFTTT we can use th... | 2019/10/08 | [
"https://wordpress.stackexchange.com/questions/350019",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/109805/"
] | I used this <https://wordpress.org/plugins/mailchimp-wp/> plugin to add an opt-in form on every page. Now I want to disable a page to auto-insert this form and make a landing page. I'll use a different opt-in form for that landing page, how can I do that? Thanks
Note: that plugin does not support except page. | IFTTT works from RSS feed, simply including your post in wordpress RSS feed can do the trick...
```
function add_cpt_to_loop_and_feed( $query ) {
if ( is_home() && $query->is_main_query() || is_feed() )
$query->set( 'post_type', array( 'post', 'download' ) );
return $query;
}
``` |
350,034 | <p>I want all posts of type 'ajde_events' as a row each with a column for some basics from the post table and some ( not all ) associated postmeta values. I have cribbed the following from this post <a href="https://wordpress.stackexchange.com/questions/251944/how-to-display-multiple-post-meta-key-meta-values-by-sql-q... | [
{
"answer_id": 350039,
"author": "maheshwaghmare",
"author_id": 52167,
"author_profile": "https://wordpress.stackexchange.com/users/52167",
"pm_score": 0,
"selected": false,
"text": "<p>This is the off topic question. But the answer is yes it is possible.</p>\n\n<p>In IFTTT we can use th... | 2019/10/08 | [
"https://wordpress.stackexchange.com/questions/350034",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/119764/"
] | I want all posts of type 'ajde\_events' as a row each with a column for some basics from the post table and some ( not all ) associated postmeta values. I have cribbed the following from this post [How to display multiple Post meta\_key/meta\_values by SQL query](https://wordpress.stackexchange.com/questions/251944/how... | IFTTT works from RSS feed, simply including your post in wordpress RSS feed can do the trick...
```
function add_cpt_to_loop_and_feed( $query ) {
if ( is_home() && $query->is_main_query() || is_feed() )
$query->set( 'post_type', array( 'post', 'download' ) );
return $query;
}
``` |
350,060 | <p>i have some fields, which i would like to print out with an shortcode with one attribute. i have normal variables and arrays, with my code only the first value of an array is printed...
<strong>should i use implode?</strong></p>
<pre><code>function leweb_test( $atts ) {
$atts = shortcode_atts( array(
... | [
{
"answer_id": 350070,
"author": "Krzysiek Dróżdż",
"author_id": 34172,
"author_profile": "https://wordpress.stackexchange.com/users/34172",
"pm_score": 2,
"selected": true,
"text": "<p>Shortcode should return string ready to append to content. You can’t return an array, because it won’t... | 2019/10/09 | [
"https://wordpress.stackexchange.com/questions/350060",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/154739/"
] | i have some fields, which i would like to print out with an shortcode with one attribute. i have normal variables and arrays, with my code only the first value of an array is printed...
**should i use implode?**
```
function leweb_test( $atts ) {
$atts = shortcode_atts( array(
'field' => 'user_email',
... | Shortcode should return string ready to append to content. You can’t return an array, because it won’t be printed correctly.
So if your shortcode should return an array, you have to figure out how this data should be formatted.
One way to do it is to use commas to separate the values:
```
return implode( ', ', $valu... |
350,090 | <p>I would like to change one thing on my wordpress custom template - there are big image sliders used throughout the site except on the contact us, checkout and my account pages. The blog page was added after these were created, so in the header.php file this is what is currently there to exclude the slider images (or... | [
{
"answer_id": 350070,
"author": "Krzysiek Dróżdż",
"author_id": 34172,
"author_profile": "https://wordpress.stackexchange.com/users/34172",
"pm_score": 2,
"selected": true,
"text": "<p>Shortcode should return string ready to append to content. You can’t return an array, because it won’t... | 2019/10/09 | [
"https://wordpress.stackexchange.com/questions/350090",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/176497/"
] | I would like to change one thing on my wordpress custom template - there are big image sliders used throughout the site except on the contact us, checkout and my account pages. The blog page was added after these were created, so in the header.php file this is what is currently there to exclude the slider images (or in... | Shortcode should return string ready to append to content. You can’t return an array, because it won’t be printed correctly.
So if your shortcode should return an array, you have to figure out how this data should be formatted.
One way to do it is to use commas to separate the values:
```
return implode( ', ', $valu... |
350,166 | <p>I want to get/show only available tags under custom taxonomy. Here's my code;</p>
<pre><code>$tax = $wp_query->get_queried_object(); // print current taxonomy
$args = array(
'post_type' => 'types', // CPT
'taxonomy' => $tax->slug, //get current taxonomy page
'orderby' => 'name',
'o... | [
{
"answer_id": 350135,
"author": "Anaksunaman",
"author_id": 172305,
"author_profile": "https://wordpress.stackexchange.com/users/172305",
"pm_score": 1,
"selected": false,
"text": "<blockquote>\n <p>Can I install a WordPress site locally from a <code>.tar.gz</code> file?</p>\n</blockqu... | 2019/10/10 | [
"https://wordpress.stackexchange.com/questions/350166",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/154507/"
] | I want to get/show only available tags under custom taxonomy. Here's my code;
```
$tax = $wp_query->get_queried_object(); // print current taxonomy
$args = array(
'post_type' => 'types', // CPT
'taxonomy' => $tax->slug, //get current taxonomy page
'orderby' => 'name',
'order' => 'DESC',
'hide_em... | >
> Can I install a WordPress site locally from a `.tar.gz` file?
>
>
>
This likely depends entirely on the contents of the archive. `.tar.gz` is just a compression format. You will have to extract it to have any website work correctly but otherwise the particular storage format has no bearing on your question.
>... |
350,203 | <p>I would like to be able to add Gutenberg blocks to an ACF options page. I've been doing quite a bit of researching but have found nothing. For instance it would be nice to have a footer block and have it rendered/previewed on the "Footer" options page like it would be on the front end. Anyone know if this is possib... | [
{
"answer_id": 376072,
"author": "Łukasz Górski",
"author_id": 195750,
"author_profile": "https://wordpress.stackexchange.com/users/195750",
"pm_score": 1,
"selected": false,
"text": "<p>Create a page named as your archive, add blocks there. In archive-name.php please add:</p>\n<pre><cod... | 2019/10/10 | [
"https://wordpress.stackexchange.com/questions/350203",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/69781/"
] | I would like to be able to add Gutenberg blocks to an ACF options page. I've been doing quite a bit of researching but have found nothing. For instance it would be nice to have a footer block and have it rendered/previewed on the "Footer" options page like it would be on the front end. Anyone know if this is possible? | Create a page named as your archive, add blocks there. In archive-name.php please add:
```
<?php get_header();
$page_id = get_post( 57 );
$page = apply_filters( 'the_content', $page->post_content );
echo $page; ?>
<?php get_footer();
```
Replace '57' with your page ID. Now you can manage content of archive pag... |
350,206 | <p>I'm building a custom theme and it's my first time doing this with the new(ish) block editor.</p>
<p>Can I ask - where on earth to add the page title in the backend block editor? In the old editor you just added it at the top of the page.</p>
<p>I've added a 'title' but this is just the h2 default title, not the p... | [
{
"answer_id": 376072,
"author": "Łukasz Górski",
"author_id": 195750,
"author_profile": "https://wordpress.stackexchange.com/users/195750",
"pm_score": 1,
"selected": false,
"text": "<p>Create a page named as your archive, add blocks there. In archive-name.php please add:</p>\n<pre><cod... | 2019/10/10 | [
"https://wordpress.stackexchange.com/questions/350206",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/106972/"
] | I'm building a custom theme and it's my first time doing this with the new(ish) block editor.
Can I ask - where on earth to add the page title in the backend block editor? In the old editor you just added it at the top of the page.
I've added a 'title' but this is just the h2 default title, not the page title/name.
... | Create a page named as your archive, add blocks there. In archive-name.php please add:
```
<?php get_header();
$page_id = get_post( 57 );
$page = apply_filters( 'the_content', $page->post_content );
echo $page; ?>
<?php get_footer();
```
Replace '57' with your page ID. Now you can manage content of archive pag... |
350,210 | <p>I need a second opinion and a sanity check if the solution I'm trying to implement will work.</p>
<p>I need to implement a way to run a script that would otherwise be blocking if I would run it using just ajax (and would probably timeout). So my idea is to do the following:</p>
<p>Have a button in the admin that, ... | [
{
"answer_id": 376072,
"author": "Łukasz Górski",
"author_id": 195750,
"author_profile": "https://wordpress.stackexchange.com/users/195750",
"pm_score": 1,
"selected": false,
"text": "<p>Create a page named as your archive, add blocks there. In archive-name.php please add:</p>\n<pre><cod... | 2019/10/10 | [
"https://wordpress.stackexchange.com/questions/350210",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/58895/"
] | I need a second opinion and a sanity check if the solution I'm trying to implement will work.
I need to implement a way to run a script that would otherwise be blocking if I would run it using just ajax (and would probably timeout). So my idea is to do the following:
Have a button in the admin that, when clicked, wou... | Create a page named as your archive, add blocks there. In archive-name.php please add:
```
<?php get_header();
$page_id = get_post( 57 );
$page = apply_filters( 'the_content', $page->post_content );
echo $page; ?>
<?php get_footer();
```
Replace '57' with your page ID. Now you can manage content of archive pag... |
350,245 | <p>I'm transferring a 20 page static HTML site to a custom Wordpress Theme. On each page of the static site the <code>body</code> tag has a custom CSS class i.e. 'banking-page'.</p>
<p>I know that WP generates page id classes in the body tag to represent the individual pages (i.e. .page-id-27), but in terms of readabi... | [
{
"answer_id": 350250,
"author": "Faye",
"author_id": 76600,
"author_profile": "https://wordpress.stackexchange.com/users/76600",
"pm_score": 2,
"selected": false,
"text": "<p>Couple of options for you.</p>\n\n<p><strong>Option 1: Use the <code>body_class()</code> function to add the pag... | 2019/10/10 | [
"https://wordpress.stackexchange.com/questions/350245",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/106972/"
] | I'm transferring a 20 page static HTML site to a custom Wordpress Theme. On each page of the static site the `body` tag has a custom CSS class i.e. 'banking-page'.
I know that WP generates page id classes in the body tag to represent the individual pages (i.e. .page-id-27), but in terms of readability (and transferabi... | In your functions.php:
```
function my_body_class($classes) {
if(is_page()){
global $page;
$title = get_the_title( $page );
$classes[] = $title;
}
return $classes;
}
add_filter('body_class', 'my_body_class');
```
That will add the page title as a class to each page. |
350,272 | <hr>
<p>EDIT - SOLUTION GIVEN IN COMMENTS</p>
<p>The problem was that I was initially hooking in at wp_enqueue_scripts so I wanted a high priority to make sure my dequeue was happening after the plugin's enqueue. When I switched to using wp_print_scripts (or more accuratly wp_print_footer_scripts) I should have switc... | [
{
"answer_id": 350276,
"author": "majick",
"author_id": 76440,
"author_profile": "https://wordpress.stackexchange.com/users/76440",
"pm_score": 1,
"selected": false,
"text": "<p>Another option is to use the <code>script_loader_tag</code> filter to catch and remove the actual HTML tag bef... | 2019/10/11 | [
"https://wordpress.stackexchange.com/questions/350272",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/176626/"
] | ---
EDIT - SOLUTION GIVEN IN COMMENTS
The problem was that I was initially hooking in at wp\_enqueue\_scripts so I wanted a high priority to make sure my dequeue was happening after the plugin's enqueue. When I switched to using wp\_print\_scripts (or more accuratly wp\_print\_footer\_scripts) I should have switched ... | Thanks to Jacob Peattie for answering this in the comments!
The problem was using a high priority with wp\_print\_footer\_scripts when I should have been using a low priority.
```
function jw_dequeue_social_login(){
wp_dequeue_script('wc-social-login-frontend');
wp_deregister_script('wc-social-login-f... |
350,283 | <p>I've stumbled on an activation error of the plugin, I'm developing and I can't seem to remove it. The error says "Plugin generate 2890 characters of unexpected output when activated".
The purpose of my plugin is to view a banner at the website with information of an event happening. Both the banner and functionality... | [
{
"answer_id": 350344,
"author": "majick",
"author_id": 76440,
"author_profile": "https://wordpress.stackexchange.com/users/76440",
"pm_score": 2,
"selected": true,
"text": "<p>It is unfortunate core only gives you the string length when it has the entire output available to display. How... | 2019/10/11 | [
"https://wordpress.stackexchange.com/questions/350283",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/176633/"
] | I've stumbled on an activation error of the plugin, I'm developing and I can't seem to remove it. The error says "Plugin generate 2890 characters of unexpected output when activated".
The purpose of my plugin is to view a banner at the website with information of an event happening. Both the banner and functionality wo... | It is unfortunate core only gives you the string length when it has the entire output available to display. However you can find what those unexpected characters are by dumping them (from the output buffer) to a file on activation. Try adding this (outside the plugin you are activating of course, eg. in a PHP file in `... |
350,295 | <p>My filter works good, but for all pages and I need add filter only for specific post type.
I try it via is_singular, but not work.
My code:</p>
<pre><code> function my_super_filer_function6($query_args){
if ( is_singular( 'post' ) ) {
global $post;
$post_author = $post->post_author;
$query_arg... | [
{
"answer_id": 350298,
"author": "Howdy_McGee",
"author_id": 7355,
"author_profile": "https://wordpress.stackexchange.com/users/7355",
"pm_score": 2,
"selected": true,
"text": "<p>There's a couple ways you could handle this.</p>\n\n<p><strong>Option 1</strong> Check the <code>global $pos... | 2019/10/11 | [
"https://wordpress.stackexchange.com/questions/350295",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/118182/"
] | My filter works good, but for all pages and I need add filter only for specific post type.
I try it via is\_singular, but not work.
My code:
```
function my_super_filer_function6($query_args){
if ( is_singular( 'post' ) ) {
global $post;
$post_author = $post->post_author;
$query_args['author'] = $p... | There's a couple ways you could handle this.
**Option 1** Check the `global $post` object
Inside your filter you may be able to check the current `$post` object or other [Conditional Tags](https://codex.wordpress.org/Conditional_Tags) for a specific type.
```
function my_super_filer_function6( $args ) {
global ... |
350,308 | <p>I have created a shortcode with this code:</p>
<pre><code>add_shortcode('recent-newsletter', 'recent_newsletter');
function recent_newsletter() {
$recentnews = new WP_Query(array(
'post_type' => 'newsletter',
'posts_per_page' => 1
));
$news ='';
if ($recentnews->have_posts()... | [
{
"answer_id": 350330,
"author": "Jacob Peattie",
"author_id": 39152,
"author_profile": "https://wordpress.stackexchange.com/users/39152",
"pm_score": 3,
"selected": true,
"text": "<p>The first argument of <a href=\"https://developer.wordpress.org/reference/functions/get_the_post_thumbna... | 2019/10/11 | [
"https://wordpress.stackexchange.com/questions/350308",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/105668/"
] | I have created a shortcode with this code:
```
add_shortcode('recent-newsletter', 'recent_newsletter');
function recent_newsletter() {
$recentnews = new WP_Query(array(
'post_type' => 'newsletter',
'posts_per_page' => 1
));
$news ='';
if ($recentnews->have_posts()) {
while($rece... | The first argument of [`get_the_post_thumbnail()`](https://developer.wordpress.org/reference/functions/get_the_post_thumbnail/) is not the image size that you want to use. It's the ID or object of the post whose thumbnail you want to get. To get the thumbnail size, set the *second* argument to `'thumbnail'`. The first ... |
350,324 | <p>I have a jQuery UI sortable list, connected to another list, so far my JavaScript can display the HTML ID's from both of the lists to the screen, but I am having trouble figuring out how to direct this data to a PHP file so I can work with it. Is <code>wp_localize_script</code> necessary for me? I have it pointing a... | [
{
"answer_id": 350408,
"author": "Welcher",
"author_id": 27210,
"author_profile": "https://wordpress.stackexchange.com/users/27210",
"pm_score": 3,
"selected": true,
"text": "<p>The only way to do this at the moment is by using the <code>renderAppender</code>prop on<code>InnerBlocks</cod... | 2019/10/11 | [
"https://wordpress.stackexchange.com/questions/350324",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/174068/"
] | I have a jQuery UI sortable list, connected to another list, so far my JavaScript can display the HTML ID's from both of the lists to the screen, but I am having trouble figuring out how to direct this data to a PHP file so I can work with it. Is `wp_localize_script` necessary for me? I have it pointing ajaxurl `plugin... | The only way to do this at the moment is by using the `renderAppender`prop on`InnerBlocks`. This prop is only available in the Gutenberg plugin until WordPress 5.3 is released. The theory would be to use state in each `CustomCard` to track if there has been a block added, then return false from the `renderAppender` fun... |
350,335 | <p>I have developed a custom PHP page with filters, add to cart module, music playlist everything. How can i implement it into WordPress? I am a newbie, any help thanks.</p>
<p>My custom PHP work directory structure :</p>
<pre><code>location : public_html/my_work
website URL : website.com/my_work
</code></pre>
<... | [
{
"answer_id": 350457,
"author": "NextGenThemes",
"author_id": 38602,
"author_profile": "https://wordpress.stackexchange.com/users/38602",
"pm_score": 2,
"selected": false,
"text": "<p>Abandon your old structure! Possibly move it into a plugin. You are entering a new and complicated worl... | 2019/10/12 | [
"https://wordpress.stackexchange.com/questions/350335",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/93212/"
] | I have developed a custom PHP page with filters, add to cart module, music playlist everything. How can i implement it into WordPress? I am a newbie, any help thanks.
My custom PHP work directory structure :
```
location : public_html/my_work
website URL : website.com/my_work
```
Everything is working good, but... | You can integrate your PHP file into WordPress with various ways like you can create a plugins and activate plugins and then you get all your PHP file accessible to WP functions.
It's bit dirty but in your case if you wish you add `require_once(rtrim($_SERVER['DOCUMENT_ROOT'], '/') . '/wp-load.php');` on top of the f... |
350,378 | <p>i hope you help me with this,</p>
<p>i am making a wordpress website witch has 3 diffrent post types(the regular post type and 2 others), i have the pagenation work very with in the regular posts page, but it does not work in the other 2 page of the other custom posts, when i tried to solve this out i found that th... | [
{
"answer_id": 350457,
"author": "NextGenThemes",
"author_id": 38602,
"author_profile": "https://wordpress.stackexchange.com/users/38602",
"pm_score": 2,
"selected": false,
"text": "<p>Abandon your old structure! Possibly move it into a plugin. You are entering a new and complicated worl... | 2019/10/12 | [
"https://wordpress.stackexchange.com/questions/350378",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/174298/"
] | i hope you help me with this,
i am making a wordpress website witch has 3 diffrent post types(the regular post type and 2 others), i have the pagenation work very with in the regular posts page, but it does not work in the other 2 page of the other custom posts, when i tried to solve this out i found that the problem ... | You can integrate your PHP file into WordPress with various ways like you can create a plugins and activate plugins and then you get all your PHP file accessible to WP functions.
It's bit dirty but in your case if you wish you add `require_once(rtrim($_SERVER['DOCUMENT_ROOT'], '/') . '/wp-load.php');` on top of the f... |
350,386 | <p>I am developing an android app that give users ability to browse , register, login, post and comment to my wordpress blog using Rest Api . </p>
<p>I am trying now to add a way for users to update their avatars , but i have no idea how to upload media to my blog </p>
<pre><code>
add_action('rest_api_init', function... | [
{
"answer_id": 350417,
"author": "Brink Press",
"author_id": 176528,
"author_profile": "https://wordpress.stackexchange.com/users/176528",
"pm_score": -1,
"selected": false,
"text": "<p>WordPress has a built-in function <a href=\"https://codex.wordpress.org/Function_Reference/media_handl... | 2019/10/12 | [
"https://wordpress.stackexchange.com/questions/350386",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/147049/"
] | I am developing an android app that give users ability to browse , register, login, post and comment to my wordpress blog using Rest Api .
I am trying now to add a way for users to update their avatars , but i have no idea how to upload media to my blog
```
add_action('rest_api_init', function () {
register_res... | You can upload media through the REST API, but to associate it with a user you'll need a plugin or your own custom REST Route. Duplicate of: [How to change user avatar using REST API?](https://wordpress.stackexchange.com/questions/380158/how-to-change-user-avatar-using-rest-api) |
350,403 | <p>How to change this code so that it sends the email notification <strong>after successfully payment</strong> in WooCommerce?</p>
<pre><code>add_action( 'woocommerce_applied_coupon', 'custom_email_on_applied_coupon', 10, 1 );
function custom_email_on_applied_coupon( $coupon_code ){
if( $coupon_code == 'mycoupon' ... | [
{
"answer_id": 350417,
"author": "Brink Press",
"author_id": 176528,
"author_profile": "https://wordpress.stackexchange.com/users/176528",
"pm_score": -1,
"selected": false,
"text": "<p>WordPress has a built-in function <a href=\"https://codex.wordpress.org/Function_Reference/media_handl... | 2019/10/13 | [
"https://wordpress.stackexchange.com/questions/350403",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/48812/"
] | How to change this code so that it sends the email notification **after successfully payment** in WooCommerce?
```
add_action( 'woocommerce_applied_coupon', 'custom_email_on_applied_coupon', 10, 1 );
function custom_email_on_applied_coupon( $coupon_code ){
if( $coupon_code == 'mycoupon' ){
$to = "john@gma... | You can upload media through the REST API, but to associate it with a user you'll need a plugin or your own custom REST Route. Duplicate of: [How to change user avatar using REST API?](https://wordpress.stackexchange.com/questions/380158/how-to-change-user-avatar-using-rest-api) |
350,472 | <p>New to Wordpress development.</p>
<p>I am using a plugin that uses custom posts types to create online courses.</p>
<p>I noticed that the plugin has a file called </p>
<p>/wp-content/plugins/sfwd-lms/includes/classes/class-ldlms-topic-model.php</p>
<p>It contains:</p>
<pre><code><?php
if ( ( class_exists( 'L... | [
{
"answer_id": 350474,
"author": "Tom J Nowell",
"author_id": 736,
"author_profile": "https://wordpress.stackexchange.com/users/736",
"pm_score": 2,
"selected": false,
"text": "<blockquote>\n <p>I just came from Laravel development so I suppose there is a wordpress-ish way to go about a... | 2019/10/14 | [
"https://wordpress.stackexchange.com/questions/350472",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/176321/"
] | New to Wordpress development.
I am using a plugin that uses custom posts types to create online courses.
I noticed that the plugin has a file called
/wp-content/plugins/sfwd-lms/includes/classes/class-ldlms-topic-model.php
It contains:
```
<?php
if ( ( class_exists( 'LDLMS_Model_Post' ) ) && ( ! class_exists( 'LD... | >
> I just came from Laravel development so I suppose there is a wordpress-ish way to go about accessing a model and maybe I am missing some step?
>
>
>
You don't, Laravel is a framework that provides structure, and so models are models, but in WP there's none of that.
Plugins in WordPress are just PHP files with... |
350,505 | <p>I have some custom taxonomy for regions.</p>
<p>Commonly it would look something like this.</p>
<pre><code>USA (parent)
- Arizona (child 1)
- - Phoenix (child 2)
</code></pre>
<p>however, there will be cases where it will only be like </p>
<pre><code>USA
- Arizona
</code></pre>
<p>or</p>
<pre><code>UK
- Wales
... | [
{
"answer_id": 350474,
"author": "Tom J Nowell",
"author_id": 736,
"author_profile": "https://wordpress.stackexchange.com/users/736",
"pm_score": 2,
"selected": false,
"text": "<blockquote>\n <p>I just came from Laravel development so I suppose there is a wordpress-ish way to go about a... | 2019/10/15 | [
"https://wordpress.stackexchange.com/questions/350505",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/176711/"
] | I have some custom taxonomy for regions.
Commonly it would look something like this.
```
USA (parent)
- Arizona (child 1)
- - Phoenix (child 2)
```
however, there will be cases where it will only be like
```
USA
- Arizona
```
or
```
UK
- Wales
```
and maybe even just
```
Japan
```
In my for loop I get the... | >
> I just came from Laravel development so I suppose there is a wordpress-ish way to go about accessing a model and maybe I am missing some step?
>
>
>
You don't, Laravel is a framework that provides structure, and so models are models, but in WP there's none of that.
Plugins in WordPress are just PHP files with... |
350,537 | <p>i see code in link how to showing User's Post Counts by Custom Post Type in the Admin's User List, but i want show posts count in author.php</p>
<p><a href="https://wordpress.stackexchange.com/questions/3233/showing-users-post-counts-by-custom-post-type-in-the-admins-user-list">Showing User's Post Counts by Cus... | [
{
"answer_id": 350548,
"author": "Anteraez",
"author_id": 176312,
"author_profile": "https://wordpress.stackexchange.com/users/176312",
"pm_score": 0,
"selected": false,
"text": "<p>You can use the following code to get the post count published by a user in the author.php file</p>\n\n<pr... | 2019/10/15 | [
"https://wordpress.stackexchange.com/questions/350537",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/144156/"
] | i see code in link how to showing User's Post Counts by Custom Post Type in the Admin's User List, but i want show posts count in author.php
[Showing User's Post Counts by Custom Post Type in the Admin's User List?](https://wordpress.stackexchange.com/questions/3233/showing-users-post-counts-by-custom-post-type-in-the... | Here I've modified the code from URL you've given.
```
function _yoursite_get_author_post_type_counts() {
static $counts;
if (!isset($counts)) {
global $wpdb;
global $wp_post_types;
$sql = <<<SQL
SELECT
post_type,
post_author,
COUNT(*) AS post_count
... |
350,538 | <p>I know we can manually edit the breadcrumb title for a page or post using Yoast SEO's breadcrumb functionality. </p>
<p>But with thousands of posts and pages on an existing site this isn't desirable. </p>
<p>My brain goes full potato when it comes to stuff other than html and css and maybe hacking some existing PH... | [
{
"answer_id": 364269,
"author": "RedForest",
"author_id": 186251,
"author_profile": "https://wordpress.stackexchange.com/users/186251",
"pm_score": 3,
"selected": false,
"text": "<p>Yoast does have a filter for you to use. See here:\n<a href=\"https://gist.github.com/jmcclellan/b2d97ffe... | 2019/10/15 | [
"https://wordpress.stackexchange.com/questions/350538",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/176820/"
] | I know we can manually edit the breadcrumb title for a page or post using Yoast SEO's breadcrumb functionality.
But with thousands of posts and pages on an existing site this isn't desirable.
My brain goes full potato when it comes to stuff other than html and css and maybe hacking some existing PHP code snippets t... | Yoast does have a filter for you to use. See here:
<https://gist.github.com/jmcclellan/b2d97ffee0e924e28fa1>
I used this to add "parent" pages to custom post types. We wanted to use pages as our category landers w/ custom post types as children. Yoast would not output the parent page slug by default since there is tec... |
350,539 | <p>I'm change the default attributes:</p>
<pre><code>const blockAttrs = {
avatarSize: {
type: 'number',
default: 120, // 70 -> 120
},
//other attrs
};
</code></pre>
<p>Deprecated function:</p>
<pre><code>deprecated: [
{
attributes: ... | [
{
"answer_id": 367570,
"author": "Asante Media",
"author_id": 127010,
"author_profile": "https://wordpress.stackexchange.com/users/127010",
"pm_score": 2,
"selected": false,
"text": "<p>Looking at the documentation from <a href=\"https://developer.wordpress.org/block-editor/developers/b... | 2019/10/15 | [
"https://wordpress.stackexchange.com/questions/350539",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/154059/"
] | I'm change the default attributes:
```
const blockAttrs = {
avatarSize: {
type: 'number',
default: 120, // 70 -> 120
},
//other attrs
};
```
Deprecated function:
```
deprecated: [
{
attributes: {
...blockAttrs,
... | Looking at the documentation from <https://developer.wordpress.org/block-editor/developers/block-api/block-deprecation/>
I think you may need the following
```
migrate( { text } ) {
return {
content: text
};
},
```
So in your case:
```
migrate( { avatarSize } ) {
... |
350,545 | <p>Since my wordpress-instalation updated itself, i cant get access to the wp-admin page.
All i get is a blank page with</p>
<pre><code>Warning: Cannot modify header information - headers already sent by (output started at /www/htdocs/v084729/wordpress/wp-content/themes/sjr/functions.php:1) in /www/htdocs/v084729/word... | [
{
"answer_id": 367570,
"author": "Asante Media",
"author_id": 127010,
"author_profile": "https://wordpress.stackexchange.com/users/127010",
"pm_score": 2,
"selected": false,
"text": "<p>Looking at the documentation from <a href=\"https://developer.wordpress.org/block-editor/developers/b... | 2019/10/15 | [
"https://wordpress.stackexchange.com/questions/350545",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/176826/"
] | Since my wordpress-instalation updated itself, i cant get access to the wp-admin page.
All i get is a blank page with
```
Warning: Cannot modify header information - headers already sent by (output started at /www/htdocs/v084729/wordpress/wp-content/themes/sjr/functions.php:1) in /www/htdocs/v084729/wordpress/wp-inclu... | Looking at the documentation from <https://developer.wordpress.org/block-editor/developers/block-api/block-deprecation/>
I think you may need the following
```
migrate( { text } ) {
return {
content: text
};
},
```
So in your case:
```
migrate( { avatarSize } ) {
... |
350,554 | <p>I'd like host review branches for staging, to test and get feedback before publishing to production. I tried to follow some documentation provided online such as the NGINX recipes ( <a href="https://www.nginx.com/resources/wiki/start/topics/recipes/wordpress/" rel="nofollow noreferrer">https://www.nginx.com/resource... | [
{
"answer_id": 367570,
"author": "Asante Media",
"author_id": 127010,
"author_profile": "https://wordpress.stackexchange.com/users/127010",
"pm_score": 2,
"selected": false,
"text": "<p>Looking at the documentation from <a href=\"https://developer.wordpress.org/block-editor/developers/b... | 2019/10/15 | [
"https://wordpress.stackexchange.com/questions/350554",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/176832/"
] | I'd like host review branches for staging, to test and get feedback before publishing to production. I tried to follow some documentation provided online such as the NGINX recipes ( <https://www.nginx.com/resources/wiki/start/topics/recipes/wordpress/> ) without success! So, how to fix it?
The pattern for the review b... | Looking at the documentation from <https://developer.wordpress.org/block-editor/developers/block-api/block-deprecation/>
I think you may need the following
```
migrate( { text } ) {
return {
content: text
};
},
```
So in your case:
```
migrate( { avatarSize } ) {
... |
350,557 | <p>I was moving something in my web to add a class to all my images, and now i have this message:</p>
<p>[15-Oct-2019 10:44:01 UTC] PHP Notice: Trying to get property 'post_title' of non-object in /home/public_html/wp-includes/nav-menu.php on line 825</p>
<p>[15-Oct-2019 10:44:01 UTC] PHP Notice: Trying to get prop... | [
{
"answer_id": 350558,
"author": "Tom J Nowell",
"author_id": 736,
"author_profile": "https://wordpress.stackexchange.com/users/736",
"pm_score": 1,
"selected": false,
"text": "<p>The root problem here is assumptions.</p>\n\n<p>For example lets say we have an array here:</p>\n\n<pre clas... | 2019/10/15 | [
"https://wordpress.stackexchange.com/questions/350557",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/176825/"
] | I was moving something in my web to add a class to all my images, and now i have this message:
[15-Oct-2019 10:44:01 UTC] PHP Notice: Trying to get property 'post\_title' of non-object in /home/public\_html/wp-includes/nav-menu.php on line 825
[15-Oct-2019 10:44:01 UTC] PHP Notice: Trying to get property 'ID' of non-... | The root problem here is assumptions.
For example lets say we have an array here:
```php
$test = [
'foo' => 'bar'
];
```
If we run `echo $test['foo'];` we should see *bar*, but what if we ran `echo $test['bananas'];`? There is no bananas entry in that array, so PHP will notice this, throw a warning/notice simil... |
350,560 | <p>I have changed default permalinks into custom structure, and I got 404 error across all of my site.</p>
| [
{
"answer_id": 350558,
"author": "Tom J Nowell",
"author_id": 736,
"author_profile": "https://wordpress.stackexchange.com/users/736",
"pm_score": 1,
"selected": false,
"text": "<p>The root problem here is assumptions.</p>\n\n<p>For example lets say we have an array here:</p>\n\n<pre clas... | 2019/10/15 | [
"https://wordpress.stackexchange.com/questions/350560",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/176834/"
] | I have changed default permalinks into custom structure, and I got 404 error across all of my site. | The root problem here is assumptions.
For example lets say we have an array here:
```php
$test = [
'foo' => 'bar'
];
```
If we run `echo $test['foo'];` we should see *bar*, but what if we ran `echo $test['bananas'];`? There is no bananas entry in that array, so PHP will notice this, throw a warning/notice simil... |
350,579 | <p>I've got a conflict with another plugin which is blocking the JS in my custom plugin with the hook:</p>
<pre><code>add_action('wp_enqueue_scripts', '<FOREIGN-PLUGIN>');
</code></pre>
<p>Is there a way to enqueue my JS before all other plugins?</p>
<p>I tried already to set priority like</p>
<pre><code>add_... | [
{
"answer_id": 350580,
"author": "KGreene",
"author_id": 175001,
"author_profile": "https://wordpress.stackexchange.com/users/175001",
"pm_score": -1,
"selected": false,
"text": "<p>Use dependencies. Dependencies are scripts that your script relies upon to be loaded first. The <code><... | 2019/10/15 | [
"https://wordpress.stackexchange.com/questions/350579",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/122620/"
] | 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 all other plugins?
I tried already to set priority like
```
add_action('wp_enqueue_scripts', '<FOREIGN-PLUGIN>', 1... | If the plugin does not include a priority, then the priority is "10" (the default).
So without changing (editing) the offending plugin, you can use a priority higher than 10 to load after, or lower than 10 to load earlier.
You mentioned that you want yours to load earlier. If that's the case, the priority in your ex... |
350,681 | <p>I'm attempting to store both an Image's URL and ID in a post's meta field via a Gutenberg component, but am having trouble figuring out how to store those multiple values in an array.</p>
<p>I can store a <em>single</em> value as a meta value without a problem. I can even store a single value in the first spot of a... | [
{
"answer_id": 350683,
"author": "Tom J Nowell",
"author_id": 736,
"author_profile": "https://wordpress.stackexchange.com/users/736",
"pm_score": 1,
"selected": false,
"text": "<p>The short answer is, you shouldn't.</p>\n\n<p>Post meta/etc store a single value, and to get around that som... | 2019/10/16 | [
"https://wordpress.stackexchange.com/questions/350681",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/172153/"
] | I'm attempting to store both an Image's URL and ID in a post's meta field via a Gutenberg component, but am having trouble figuring out how to store those multiple values in an array.
I can store a *single* value as a meta value without a problem. I can even store a single value in the first spot of an array without a... | Have you tried using:
```js
setImage: function( image_url, image_id ) {
dispatch( 'core/editor' ).editPost(
{
meta: {
'og_image_url': image_url,
'og_image_id': image_id
... |
350,765 | <p>I've changed the <code>http://</code> host <code>to https://</code>, then accidentally saved it. Now I can't log in to the admin panel having '404 Not Found' page. How can I fix this?</p>
| [
{
"answer_id": 350766,
"author": "Matthew Brown aka Lord Matt",
"author_id": 109240,
"author_profile": "https://wordpress.stackexchange.com/users/109240",
"pm_score": -1,
"selected": false,
"text": "<p>Before I start, I should point out that I am making a few educated guesses about what ... | 2019/10/18 | [
"https://wordpress.stackexchange.com/questions/350765",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/176988/"
] | I've changed the `http://` host `to https://`, then accidentally saved it. Now I can't log in to the admin panel having '404 Not Found' page. How can I fix this? | ```
define( 'WP_HOME', 'http://example.com' );
define( 'WP_SITEURL', 'http://example.com' );
```
Add this to your `wp-config.php` which you can find in the root of your website. Remember to change `example.com` to your URL. |
350,772 | <p>I'm using the WooCommerce Waitlist plugin, but I'd like to change it to be for products that haven't been released yet, ie for "expressions of interest".</p>
<p>To do this I need to change a lot of strings, for example one that says "Join the waitlist to be emailed when this product becomes available".</p>
<p>I've... | [
{
"answer_id": 350774,
"author": "Chetan Vaghela",
"author_id": 169856,
"author_profile": "https://wordpress.stackexchange.com/users/169856",
"pm_score": 0,
"selected": false,
"text": "<p>You can change text using filter. add below code in active theme's functions.php file to change text... | 2019/10/18 | [
"https://wordpress.stackexchange.com/questions/350772",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/98960/"
] | I'm using the WooCommerce Waitlist plugin, but I'd like to change it to be for products that haven't been released yet, ie for "expressions of interest".
To do this I need to change a lot of strings, for example one that says "Join the waitlist to be emailed when this product becomes available".
I've found where this... | You are able to change texts using a **translation** file.
By default, plugin texts are in the English language. Even your site language is English, You are able to generate a new language file and change texts on it.
Imagine that the plugin folder name (plugin slug, plugin text domain) is **my-plugin** and Your site... |
350,795 | <pre><code> add_action( 'pre_get_posts' , 'my_pre_get_posts' );
Function my_pre_get_posts( $query ) {
$value= $_GET['s'];
if( $query->is_main_query() && $query->is_search()) {
$query->set(
'meta_query',
array(
array(
... | [
{
"answer_id": 350802,
"author": "M-R",
"author_id": 17061,
"author_profile": "https://wordpress.stackexchange.com/users/17061",
"pm_score": 1,
"selected": false,
"text": "<p>When using <code>LIKE</code> clause, you should be using <code>%</code> to the start and end of the value to make... | 2019/10/18 | [
"https://wordpress.stackexchange.com/questions/350795",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/141851/"
] | ```
add_action( 'pre_get_posts' , 'my_pre_get_posts' );
Function my_pre_get_posts( $query ) {
$value= $_GET['s'];
if( $query->is_main_query() && $query->is_search()) {
$query->set(
'meta_query',
array(
array(
'key' => 'pdf_... | When using `LIKE` clause, you should be using `%` to the start and end of the value to make it match with the existing values. So your query should look like this.
```
add_action( 'pre_get_posts' , 'my_pre_get_posts' );
function my_pre_get_posts( $query ) {
$value= '%'.$_GET['s'].'%';
if( $query->is_main_query... |
350,833 | <p>Just curious here and I need better understanding about this malware. Because their are websites are infected by this malware including my websites. But I can clean them all. Usually this malware written in strange name in .php file, inside this file:</p>
<pre><code><?php
$hsexdir = 'pmi9kl4H61gcbayrf_xsuo*-5#v... | [
{
"answer_id": 350848,
"author": "Rick Hellewell",
"author_id": 29416,
"author_profile": "https://wordpress.stackexchange.com/users/29416",
"pm_score": 1,
"selected": false,
"text": "<p>I'm also seeing this on a hosting place that has several WP installs. Cleaning them up (removing files... | 2019/10/19 | [
"https://wordpress.stackexchange.com/questions/350833",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/149781/"
] | Just curious here and I need better understanding about this malware. Because their are websites are infected by this malware including my websites. But I can clean them all. Usually this malware written in strange name in .php file, inside this file:
```
<?php
$hsexdir = 'pmi9kl4H61gcbayrf_xsuo*-5#vden3t\'7';$yiorkoj... | I'm also seeing this on a hosting place that has several WP installs. Cleaning them up (removing files that aren't supposed to be there, removing code) hasn't fixed things yet, it keeps coming back.
If you want to decode strings like that, use the <https://www.unphp.net> site. Use the recursive check button.
I've fou... |
350,850 | <p>I inherited a site that was compromised (I'm not sure what version of wordpress, the crash happened last summer). I have CLI access, and can SFTP into the server. The only thing I want to get is the content of the blogs. I was able to see the mysql files from SFTP, but they are just the .frm files. What is the best ... | [
{
"answer_id": 350848,
"author": "Rick Hellewell",
"author_id": 29416,
"author_profile": "https://wordpress.stackexchange.com/users/29416",
"pm_score": 1,
"selected": false,
"text": "<p>I'm also seeing this on a hosting place that has several WP installs. Cleaning them up (removing files... | 2019/10/19 | [
"https://wordpress.stackexchange.com/questions/350850",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/157187/"
] | I inherited a site that was compromised (I'm not sure what version of wordpress, the crash happened last summer). I have CLI access, and can SFTP into the server. The only thing I want to get is the content of the blogs. I was able to see the mysql files from SFTP, but they are just the .frm files. What is the best way... | I'm also seeing this on a hosting place that has several WP installs. Cleaning them up (removing files that aren't supposed to be there, removing code) hasn't fixed things yet, it keeps coming back.
If you want to decode strings like that, use the <https://www.unphp.net> site. Use the recursive check button.
I've fou... |
350,851 | <p>I would like to replace WordPress style.css file or any other files like this with style.css file in an external host
How can I do this?
Of course, I saw this tutorial before</p>
<p><a href="https://css-tricks.com/methods-overriding-styles-wordpress/" rel="nofollow noreferrer">https://css-tricks.com/methods-overrid... | [
{
"answer_id": 350873,
"author": "Babak Y.",
"author_id": 172699,
"author_profile": "https://wordpress.stackexchange.com/users/172699",
"pm_score": 1,
"selected": false,
"text": "<p>From what I understood you want to override some particular CSS properties from style.css of a WordPress t... | 2019/10/19 | [
"https://wordpress.stackexchange.com/questions/350851",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/177061/"
] | I would like to replace WordPress style.css file or any other files like this with style.css file in an external host
How can I do this?
Of course, I saw this tutorial before
<https://css-tricks.com/methods-overriding-styles-wordpress/>
but I don't know how can I replace this external file with my basic theme files l... | From what I understood you want to override some particular CSS properties from style.css of a WordPress theme.
There might be two different situations here which needs different solutions:
1. If you are developing your own theme then you can simply edit your functions.php inside your theme files and add any JS or CS... |
350,865 | <p>I have a client who has a WordPress site on AWS. I'm wondering if I update WordPress core and plugins do I need to create a new AMI based on the current instance, create a new launch configuration using the new instance for the auto-scaling group? Do I then delete the old instance? I've tried reading the AWS documen... | [
{
"answer_id": 350873,
"author": "Babak Y.",
"author_id": 172699,
"author_profile": "https://wordpress.stackexchange.com/users/172699",
"pm_score": 1,
"selected": false,
"text": "<p>From what I understood you want to override some particular CSS properties from style.css of a WordPress t... | 2019/10/20 | [
"https://wordpress.stackexchange.com/questions/350865",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/153685/"
] | I have a client who has a WordPress site on AWS. I'm wondering if I update WordPress core and plugins do I need to create a new AMI based on the current instance, create a new launch configuration using the new instance for the auto-scaling group? Do I then delete the old instance? I've tried reading the AWS documentat... | From what I understood you want to override some particular CSS properties from style.css of a WordPress theme.
There might be two different situations here which needs different solutions:
1. If you are developing your own theme then you can simply edit your functions.php inside your theme files and add any JS or CS... |
350,868 | <p>There are many answers to how to redirect after login. But my situation is different.
In my scenario, we have a landing page where people can login. Once logged in, the users are not logged out for a year. So, what we want to do is, when the user visits the site, check if they are logged in. If they are logged in, a... | [
{
"answer_id": 350873,
"author": "Babak Y.",
"author_id": 172699,
"author_profile": "https://wordpress.stackexchange.com/users/172699",
"pm_score": 1,
"selected": false,
"text": "<p>From what I understood you want to override some particular CSS properties from style.css of a WordPress t... | 2019/10/20 | [
"https://wordpress.stackexchange.com/questions/350868",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/124483/"
] | There are many answers to how to redirect after login. But my situation is different.
In my scenario, we have a landing page where people can login. Once logged in, the users are not logged out for a year. So, what we want to do is, when the user visits the site, check if they are logged in. If they are logged in, auto... | From what I understood you want to override some particular CSS properties from style.css of a WordPress theme.
There might be two different situations here which needs different solutions:
1. If you are developing your own theme then you can simply edit your functions.php inside your theme files and add any JS or CS... |
350,889 | <p>What I'm trying to achieve: my homepage displays 3 random posts from each of 5 different categories. That part is easy.</p>
<p>What's a little unique and I can't quite figure out how to accomplish, I would like those posts to change automatically every week.</p>
<p>That way if the user comes back a couple times du... | [
{
"answer_id": 350873,
"author": "Babak Y.",
"author_id": 172699,
"author_profile": "https://wordpress.stackexchange.com/users/172699",
"pm_score": 1,
"selected": false,
"text": "<p>From what I understood you want to override some particular CSS properties from style.css of a WordPress t... | 2019/10/20 | [
"https://wordpress.stackexchange.com/questions/350889",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/5710/"
] | What I'm trying to achieve: my homepage displays 3 random posts from each of 5 different categories. That part is easy.
What's a little unique and I can't quite figure out how to accomplish, I would like those posts to change automatically every week.
That way if the user comes back a couple times during the week, th... | From what I understood you want to override some particular CSS properties from style.css of a WordPress theme.
There might be two different situations here which needs different solutions:
1. If you are developing your own theme then you can simply edit your functions.php inside your theme files and add any JS or CS... |
350,960 | <h1>How do I make WordPress use a template for any requests where the url is <code>/careers/[0-9]+</code>?</h1>
<p>We <em>used to</em> have custom posts for job openings handled by <code>single-jobs.php</code> - then switched to an Applicant Tracking System with a nice REST API, meaning no more job posts in the data b... | [
{
"answer_id": 350978,
"author": "Howdy_McGee",
"author_id": 7355,
"author_profile": "https://wordpress.stackexchange.com/users/7355",
"pm_score": 2,
"selected": false,
"text": "<p>The easiest way is to simply create a <a href=\"https://codex.wordpress.org/Rewrite_API/add_rewrite_endpoin... | 2019/10/21 | [
"https://wordpress.stackexchange.com/questions/350960",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/117836/"
] | How do I make WordPress use a template for any requests where the url is `/careers/[0-9]+`?
===========================================================================================
We *used to* have custom posts for job openings handled by `single-jobs.php` - then switched to an Applicant Tracking System with a nic... | The easiest way is to simply create a [custom rewrite endpoint](https://codex.wordpress.org/Rewrite_API/add_rewrite_endpoint). This is a two-fer. It will create our actual permalink structure and our query var in one go.
Do note that after creating the below you will need to resave permalinks: Settings -> Permalinks -... |
351,024 | <p>Most of the time I like having the blocks the full width of my site (<a href="https://princetonfireandsafety.com/" rel="nofollow noreferrer">https://princetonfireandsafety.com/</a>), but sometimes I just want to have a single header or paragraph block that isn't that big. Like if the text is only one or two lines, i... | [
{
"answer_id": 350978,
"author": "Howdy_McGee",
"author_id": 7355,
"author_profile": "https://wordpress.stackexchange.com/users/7355",
"pm_score": 2,
"selected": false,
"text": "<p>The easiest way is to simply create a <a href=\"https://codex.wordpress.org/Rewrite_API/add_rewrite_endpoin... | 2019/10/22 | [
"https://wordpress.stackexchange.com/questions/351024",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/177189/"
] | Most of the time I like having the blocks the full width of my site (<https://princetonfireandsafety.com/>), but sometimes I just want to have a single header or paragraph block that isn't that big. Like if the text is only one or two lines, it looks really weird spanning the whole page (ie. The section on my page titl... | The easiest way is to simply create a [custom rewrite endpoint](https://codex.wordpress.org/Rewrite_API/add_rewrite_endpoint). This is a two-fer. It will create our actual permalink structure and our query var in one go.
Do note that after creating the below you will need to resave permalinks: Settings -> Permalinks -... |
351,036 | <p>My wordpress website has two languages. The theme translates properly, but whenever I use <code>get_the_date</code> it is in the default english language. How do I force the use of another language?
The <a href="https://codex.wordpress.org/Plugin_API/Filter_Reference/locale" rel="nofollow noreferrer">locale filter</... | [
{
"answer_id": 350978,
"author": "Howdy_McGee",
"author_id": 7355,
"author_profile": "https://wordpress.stackexchange.com/users/7355",
"pm_score": 2,
"selected": false,
"text": "<p>The easiest way is to simply create a <a href=\"https://codex.wordpress.org/Rewrite_API/add_rewrite_endpoin... | 2019/10/22 | [
"https://wordpress.stackexchange.com/questions/351036",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/140118/"
] | My wordpress website has two languages. The theme translates properly, but whenever I use `get_the_date` it is in the default english language. How do I force the use of another language?
The [locale filter](https://codex.wordpress.org/Plugin_API/Filter_Reference/locale) **does not** work. | The easiest way is to simply create a [custom rewrite endpoint](https://codex.wordpress.org/Rewrite_API/add_rewrite_endpoint). This is a two-fer. It will create our actual permalink structure and our query var in one go.
Do note that after creating the below you will need to resave permalinks: Settings -> Permalinks -... |
351,039 | <p>I have a wordpress ecommerce website which I have begun to update after not touching it for over a year. The first thing I did was implement reCaptcha into all inquiry and contact forms to reduce the amount of spam that is sent to my business' inbox. I have also got it working for login and user account creation, ... | [
{
"answer_id": 351043,
"author": "Hector",
"author_id": 48376,
"author_profile": "https://wordpress.stackexchange.com/users/48376",
"pm_score": 1,
"selected": false,
"text": "<p>Welcome!</p>\n\n<p><strong>Short Answer about SQL queries:</strong></p>\n\n<p>Your query in the first image is... | 2019/10/22 | [
"https://wordpress.stackexchange.com/questions/351039",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/177205/"
] | I have a wordpress ecommerce website which I have begun to update after not touching it for over a year. The first thing I did was implement reCaptcha into all inquiry and contact forms to reduce the amount of spam that is sent to my business' inbox. I have also got it working for login and user account creation, to ho... | Hector's answer works well, but if you have have a large number of users you need to remove (in my case, it was over 13,000 spam registrations) I find using this little utility script works wonders, and doesn't require you to manually check and delete from the user-list in the admin panel.
The script still might time ... |
351,041 | <p>I want to make a file download system in wordpress where user can download a specific file using filename or code.In user frontend user unable to see anything without a search box where they can enter file name or code to download the file.
How can I do This.Or which plugin should I use?</p>
| [
{
"answer_id": 351043,
"author": "Hector",
"author_id": 48376,
"author_profile": "https://wordpress.stackexchange.com/users/48376",
"pm_score": 1,
"selected": false,
"text": "<p>Welcome!</p>\n\n<p><strong>Short Answer about SQL queries:</strong></p>\n\n<p>Your query in the first image is... | 2019/10/22 | [
"https://wordpress.stackexchange.com/questions/351041",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/175887/"
] | I want to make a file download system in wordpress where user can download a specific file using filename or code.In user frontend user unable to see anything without a search box where they can enter file name or code to download the file.
How can I do This.Or which plugin should I use? | Hector's answer works well, but if you have have a large number of users you need to remove (in my case, it was over 13,000 spam registrations) I find using this little utility script works wonders, and doesn't require you to manually check and delete from the user-list in the admin panel.
The script still might time ... |
351,048 | <p>I have a category about the catalog, news1 Which I use to get a post on the main page. The problem is that I don't want the news1 category name to appear in these posts, but I want other categories to be displayed.</p>
<p>How can I do this?</p>
| [
{
"answer_id": 351053,
"author": "Masum Hasan",
"author_id": 177212,
"author_profile": "https://wordpress.stackexchange.com/users/177212",
"pm_score": -1,
"selected": false,
"text": "<p>Just make the category status \"private\". It should do the job and will not be visible publicly </p>... | 2019/10/22 | [
"https://wordpress.stackexchange.com/questions/351048",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/177208/"
] | I have a category about the catalog, news1 Which I use to get a post on the main page. The problem is that I don't want the news1 category name to appear in these posts, but I want other categories to be displayed.
How can I do this? | First of all, I wouldn't recommend to use categories to show posts anywhere. Such approach has many consequences (it creates category archive, feeds, and so on).
But if you already have such solution, then you can use [`get_the_categories`](https://core.trac.wordpress.org/browser/tags/5.2/src/wp-includes/category-temp... |
351,056 | <p>I have the <code>@wordpress/data</code> package installed, but I can't use <code>useDispatch</code> in my block edit function:</p>
<pre><code>const { registerBlockType } = wp.blocks;
const { useDispatch, useSelect } = wp.data;
.
.
.
registerBlockType( 'rb-bootstrap/grid', {
...
edit: function( props ) {
... | [
{
"answer_id": 351053,
"author": "Masum Hasan",
"author_id": 177212,
"author_profile": "https://wordpress.stackexchange.com/users/177212",
"pm_score": -1,
"selected": false,
"text": "<p>Just make the category status \"private\". It should do the job and will not be visible publicly </p>... | 2019/10/23 | [
"https://wordpress.stackexchange.com/questions/351056",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/127210/"
] | I have the `@wordpress/data` package installed, but I can't use `useDispatch` in my block edit function:
```
const { registerBlockType } = wp.blocks;
const { useDispatch, useSelect } = wp.data;
.
.
.
registerBlockType( 'rb-bootstrap/grid', {
...
edit: function( props ) {
const { replaceInnerBlocks } =... | First of all, I wouldn't recommend to use categories to show posts anywhere. Such approach has many consequences (it creates category archive, feeds, and so on).
But if you already have such solution, then you can use [`get_the_categories`](https://core.trac.wordpress.org/browser/tags/5.2/src/wp-includes/category-temp... |
351,091 | <p>I'm using a function to display a gallery and I need to load its JS/CSS only if the gallery function is called. Both functions are in the custom plugin. </p>
<p>I have now the first function to enqueue scripts and styles and function itself:</p>
<pre><code>function gallery_assets() {
$upload_dir = wp_g... | [
{
"answer_id": 351053,
"author": "Masum Hasan",
"author_id": 177212,
"author_profile": "https://wordpress.stackexchange.com/users/177212",
"pm_score": -1,
"selected": false,
"text": "<p>Just make the category status \"private\". It should do the job and will not be visible publicly </p>... | 2019/10/23 | [
"https://wordpress.stackexchange.com/questions/351091",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/142917/"
] | I'm using a function to display a gallery and I need to load its JS/CSS only if the gallery function is called. Both functions are in the custom plugin.
I have now the first function to enqueue scripts and styles and function itself:
```
function gallery_assets() {
$upload_dir = wp_get_upload_dir();
... | First of all, I wouldn't recommend to use categories to show posts anywhere. Such approach has many consequences (it creates category archive, feeds, and so on).
But if you already have such solution, then you can use [`get_the_categories`](https://core.trac.wordpress.org/browser/tags/5.2/src/wp-includes/category-temp... |
351,096 | <p>I´m making my first Woocommerce theme.
In the documentation and in <code>plugins/woocommerce/templates/single-product.php</code>, it´s written :</p>
<blockquote>
<p>This template can be overridden by copying it to yourtheme/woocommerce/single-product.php</p>
</blockquote>
<p>But when I do this, it does not work ... | [
{
"answer_id": 351110,
"author": "J.BizMai",
"author_id": 128094,
"author_profile": "https://wordpress.stackexchange.com/users/128094",
"pm_score": 1,
"selected": false,
"text": "<p>As @ChetanVaghela said in comments, to use the woocommerce structure you need to add this code line :</p>\... | 2019/10/23 | [
"https://wordpress.stackexchange.com/questions/351096",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/128094/"
] | I´m making my first Woocommerce theme.
In the documentation and in `plugins/woocommerce/templates/single-product.php`, it´s written :
>
> This template can be overridden by copying it to yourtheme/woocommerce/single-product.php
>
>
>
But when I do this, it does not work and if I put the file on my theme root, it ... | As @ChetanVaghela said in comments, to use the woocommerce structure you need to add this code line :
```
add_theme_support( 'woocommerce' );
``` |
351,136 | <p>I am having difficulty adding a custom svg icon to my Wordpress Plugin, I read on this page <a href="https://developer.wordpress.org/block-editor/components/icon/" rel="nofollow noreferrer">https://developer.wordpress.org/block-editor/components/icon/</a> that to add a custom svg icon to my plugin for my blocks I ne... | [
{
"answer_id": 351110,
"author": "J.BizMai",
"author_id": 128094,
"author_profile": "https://wordpress.stackexchange.com/users/128094",
"pm_score": 1,
"selected": false,
"text": "<p>As @ChetanVaghela said in comments, to use the woocommerce structure you need to add this code line :</p>\... | 2019/10/24 | [
"https://wordpress.stackexchange.com/questions/351136",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/48630/"
] | I am having difficulty adding a custom svg icon to my Wordpress Plugin, I read on this page <https://developer.wordpress.org/block-editor/components/icon/> that to add a custom svg icon to my plugin for my blocks I need to add the following code to my block.js file in my plugin:
```
import { Icon } from '@wordpress/co... | As @ChetanVaghela said in comments, to use the woocommerce structure you need to add this code line :
```
add_theme_support( 'woocommerce' );
``` |
351,158 | <p>I'm developing an API for my Wordpress website, I want to authorize all API request using jwt token. already installed and configured this plugin "JWT Authentication for WP REST API".But when I try via get/post methode my API will return data with out passing jwt access token how can I prevent this?</p>
<pre><code... | [
{
"answer_id": 351159,
"author": "Jacob Peattie",
"author_id": 39152,
"author_profile": "https://wordpress.stackexchange.com/users/39152",
"pm_score": 2,
"selected": true,
"text": "<p>The token just authenticates the request as coming from a specific user. You still need to use the <a hr... | 2019/10/24 | [
"https://wordpress.stackexchange.com/questions/351158",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/177290/"
] | I'm developing an API for my Wordpress website, I want to authorize all API request using jwt token. already installed and configured this plugin "JWT Authentication for WP REST API".But when I try via get/post methode my API will return data with out passing jwt access token how can I prevent this?
```
function api_v... | The token just authenticates the request as coming from a specific user. You still need to use the [permissions callback](https://developer.wordpress.org/rest-api/extending-the-rest-api/adding-custom-endpoints/#permissions-callback) to check if that user has permission for whatever it is you're doing. If you omit the `... |
351,160 | <p>Using WP 5.2.4, <strong>I am registering my custom post type with this code:</strong> </p>
<pre><code>$args = array(
'labels' => $labels,
'public' => false,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'has_archive' =&g... | [
{
"answer_id": 351164,
"author": "WebElaine",
"author_id": 102815,
"author_profile": "https://wordpress.stackexchange.com/users/102815",
"pm_score": 2,
"selected": false,
"text": "<p>You definitely need to set <code>map_meta_cap</code> to <code>true</code> instead of false to create cust... | 2019/10/24 | [
"https://wordpress.stackexchange.com/questions/351160",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/143870/"
] | Using WP 5.2.4, **I am registering my custom post type with this code:**
```
$args = array(
'labels' => $labels,
'public' => false,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'has_archive' => false,
'menu_position' => null,
... | You definitely need to set `map_meta_cap` to `true` instead of false to create custom capabilities.
I haven't seen the `'capability_type' => ['note','notes']` way of creating capabilities before - maybe it's shorthand, but if just changing `map_meta_cap` doesn't work, you might want to spell everything out the long wa... |
351,237 | <p>In my website I need a navigation menu to show arrangement of my posts. So I need the navigation menu to count the items and display the number of every item as a label before the title of that item. I think we need a <code>foreach</code> in <code>wp_get_nav_menu_items</code> to count but I don't know exactly the w... | [
{
"answer_id": 351164,
"author": "WebElaine",
"author_id": 102815,
"author_profile": "https://wordpress.stackexchange.com/users/102815",
"pm_score": 2,
"selected": false,
"text": "<p>You definitely need to set <code>map_meta_cap</code> to <code>true</code> instead of false to create cust... | 2019/10/25 | [
"https://wordpress.stackexchange.com/questions/351237",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/157522/"
] | In my website I need a navigation menu to show arrangement of my posts. So I need the navigation menu to count the items and display the number of every item as a label before the title of that item. I think we need a `foreach` in `wp_get_nav_menu_items` to count but I don't know exactly the way.
I need something li... | You definitely need to set `map_meta_cap` to `true` instead of false to create custom capabilities.
I haven't seen the `'capability_type' => ['note','notes']` way of creating capabilities before - maybe it's shorthand, but if just changing `map_meta_cap` doesn't work, you might want to spell everything out the long wa... |
351,250 | <p>I am using $ in my custom js file in a wordpress child theme.
But it says $ is not defined. But jQuery works fine.
What is the reason? Is it because $ is used in newer version of jQUery and WP uses old version 1.12.4. Kindly correct me.</p>
<p>Kind Regards</p>
| [
{
"answer_id": 351164,
"author": "WebElaine",
"author_id": 102815,
"author_profile": "https://wordpress.stackexchange.com/users/102815",
"pm_score": 2,
"selected": false,
"text": "<p>You definitely need to set <code>map_meta_cap</code> to <code>true</code> instead of false to create cust... | 2019/10/25 | [
"https://wordpress.stackexchange.com/questions/351250",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/128189/"
] | I am using $ in my custom js file in a wordpress child theme.
But it says $ is not defined. But jQuery works fine.
What is the reason? Is it because $ is used in newer version of jQUery and WP uses old version 1.12.4. Kindly correct me.
Kind Regards | You definitely need to set `map_meta_cap` to `true` instead of false to create custom capabilities.
I haven't seen the `'capability_type' => ['note','notes']` way of creating capabilities before - maybe it's shorthand, but if just changing `map_meta_cap` doesn't work, you might want to spell everything out the long wa... |