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 |
|---|---|---|---|---|---|---|
351,315 | <p>I am having an issue where an image block in Gutenberg editor is not the full with of the page even though I have selected "Full Width" in the back-end. Is there a way to fix this?</p>
<p>Image for reference:
<a href="https://i.stack.imgur.com/c1WTe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com... | [
{
"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/26 | [
"https://wordpress.stackexchange.com/questions/351315",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/152944/"
] | I am having an issue where an image block in Gutenberg editor is not the full with of the page even though I have selected "Full Width" in the back-end. Is there a way to fix this?
Image for reference:
[](https://i.stack.imgur.com/c1WTe.png) | 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,334 | <p>I have used this method to create a custom post page but I want the content to be the imported XML file content to be the content of this file.
<a href="https://stackoverflow.com/a/32314726/3697484">https://stackoverflow.com/a/32314726/3697484</a></p>
<p>I have the XML content as a file saved inside a plugin folder... | [
{
"answer_id": 351926,
"author": "Cas Dekkers",
"author_id": 153884,
"author_profile": "https://wordpress.stackexchange.com/users/153884",
"pm_score": 1,
"selected": false,
"text": "<p>So if I understand your question correctly, you have an XML file, and you would like to import it and s... | 2019/10/27 | [
"https://wordpress.stackexchange.com/questions/351334",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | I have used this method to create a custom post page but I want the content to be the imported XML file content to be the content of this file.
<https://stackoverflow.com/a/32314726/3697484>
I have the XML content as a file saved inside a plugin folder.
I am basically looking for a method to use the WordPress importe... | So, are you looking for a JSON importer for Elementor? If so, why not use their native importer? See here:
[](https://i.stack.imgur.com/cefCh.png)
However, if you would rather have an option in a menu, try this small plugin. It adds an importer under `T... |
351,357 | <p>Okay so I'm a complete newbie.
Things I've done so far: Install xampp, install wordpress, create a dummy site, have a web address I'd like to use.
The problem: My college provides homepages (www.home.uniname.edu/~username) for the students. Now, the files are handles by nextcloud. We are supposed to basically copy ... | [
{
"answer_id": 351926,
"author": "Cas Dekkers",
"author_id": 153884,
"author_profile": "https://wordpress.stackexchange.com/users/153884",
"pm_score": 1,
"selected": false,
"text": "<p>So if I understand your question correctly, you have an XML file, and you would like to import it and s... | 2019/10/28 | [
"https://wordpress.stackexchange.com/questions/351357",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/177474/"
] | Okay so I'm a complete newbie.
Things I've done so far: Install xampp, install wordpress, create a dummy site, have a web address I'd like to use.
The problem: My college provides homepages (www.home.uniname.edu/~username) for the students. Now, the files are handles by nextcloud. We are supposed to basically copy our... | So, are you looking for a JSON importer for Elementor? If so, why not use their native importer? See here:
[](https://i.stack.imgur.com/cefCh.png)
However, if you would rather have an option in a menu, try this small plugin. It adds an importer under `T... |
351,358 | <p>In my WordPress website, I am using the Cloudflare and Elementor editor also but when I am trying to edit the page using the Elementor, my Elementor is not opening. I think it is because of the Cloudflare in my WordPress.</p>
<p>Cloudflare has added the <code>script</code> in the head and also in the footer:</p>
<... | [
{
"answer_id": 351380,
"author": "Capolooper",
"author_id": 177390,
"author_profile": "https://wordpress.stackexchange.com/users/177390",
"pm_score": 0,
"selected": false,
"text": "<p>Why you are using a filter?\n<a href=\"https://developer.wordpress.org/themes/basics/including-css-javas... | 2019/10/28 | [
"https://wordpress.stackexchange.com/questions/351358",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/172395/"
] | In my WordPress website, I am using the Cloudflare and Elementor editor also but when I am trying to edit the page using the Elementor, my Elementor is not opening. I think it is because of the Cloudflare in my WordPress.
Cloudflare has added the `script` in the head and also in the footer:
```
<script src="https://a... | This helps me to solve the problem:
<https://snifflevalve.com/elementor-tutorials/elementor-cloudflares-rocket-loader-not-play-well-together/> |
351,415 | <p>How can I exclude posts with a specific custom field and value with this query?</p>
<pre><code>$my_query = new WP_Query( $args = array(
// It should be in the first category of our post:
'category__in' => array( $st_cat ),
// Our post should NOT be in the list:
'post__not_in' =&g... | [
{
"answer_id": 351416,
"author": "user10758246",
"author_id": 177508,
"author_profile": "https://wordpress.stackexchange.com/users/177508",
"pm_score": 2,
"selected": false,
"text": "<p>The meta_query argument takes an array of arrays.</p>\n\n<pre><code>'meta_query' => array(\n arr... | 2019/10/28 | [
"https://wordpress.stackexchange.com/questions/351415",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/18693/"
] | How can I exclude posts with a specific custom field and value with this query?
```
$my_query = new WP_Query( $args = array(
// It should be in the first category of our post:
'category__in' => array( $st_cat ),
// Our post should NOT be in the list:
'post__not_in' => array( $post->ID ... | The meta\_query argument takes an array of arrays.
```
'meta_query' => array(
array(
'key' => 'city',
'value' => 'true',
'compare' => 'NOT LIKE',
)
)
``` |
351,443 | <p>I'm borrowing from the code at <a href="https://wordpress.stackexchange.com/questions/45436/add-filter-menu-to-admin-list-of-posts-of-custom-type-to-filter-posts-by-custo">Add filter menu to admin list of posts (of custom type) to filter posts by custom field values</a> to add a filter to my custom post type with th... | [
{
"answer_id": 351416,
"author": "user10758246",
"author_id": 177508,
"author_profile": "https://wordpress.stackexchange.com/users/177508",
"pm_score": 2,
"selected": false,
"text": "<p>The meta_query argument takes an array of arrays.</p>\n\n<pre><code>'meta_query' => array(\n arr... | 2019/10/29 | [
"https://wordpress.stackexchange.com/questions/351443",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/86700/"
] | I'm borrowing from the code at [Add filter menu to admin list of posts (of custom type) to filter posts by custom field values](https://wordpress.stackexchange.com/questions/45436/add-filter-menu-to-admin-list-of-posts-of-custom-type-to-filter-posts-by-custo) to add a filter to my custom post type with the `parse_query... | The meta\_query argument takes an array of arrays.
```
'meta_query' => array(
array(
'key' => 'city',
'value' => 'true',
'compare' => 'NOT LIKE',
)
)
``` |
351,549 | <p>I would like to have inside my theme folder, a folder where I can leave all the portion of code and snippets that I don't want to use anymore or I just want to save for a while, and accessible every time I want to check it in the browser, the same way I usually do with frontpage.php. Something I can access through t... | [
{
"answer_id": 351416,
"author": "user10758246",
"author_id": 177508,
"author_profile": "https://wordpress.stackexchange.com/users/177508",
"pm_score": 2,
"selected": false,
"text": "<p>The meta_query argument takes an array of arrays.</p>\n\n<pre><code>'meta_query' => array(\n arr... | 2019/10/30 | [
"https://wordpress.stackexchange.com/questions/351549",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/70257/"
] | I would like to have inside my theme folder, a folder where I can leave all the portion of code and snippets that I don't want to use anymore or I just want to save for a while, and accessible every time I want to check it in the browser, the same way I usually do with frontpage.php. Something I can access through the ... | The meta\_query argument takes an array of arrays.
```
'meta_query' => array(
array(
'key' => 'city',
'value' => 'true',
'compare' => 'NOT LIKE',
)
)
``` |
351,567 | <p>I'm using this code to add the alt text to my featured images on upload.</p>
<pre><code>$image_title = get_post( $post->ID )->post_title;
// Sanitize the title: remove hyphens, underscores & extra spaces:
$image_title = preg_replace( '%\s*[-_\s]+\s*%', ' ', $image_title );
// Sanitize the title: capita... | [
{
"answer_id": 351416,
"author": "user10758246",
"author_id": 177508,
"author_profile": "https://wordpress.stackexchange.com/users/177508",
"pm_score": 2,
"selected": false,
"text": "<p>The meta_query argument takes an array of arrays.</p>\n\n<pre><code>'meta_query' => array(\n arr... | 2019/10/30 | [
"https://wordpress.stackexchange.com/questions/351567",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/18693/"
] | I'm using this code to add the alt text to my featured images on upload.
```
$image_title = get_post( $post->ID )->post_title;
// Sanitize the title: remove hyphens, underscores & extra spaces:
$image_title = preg_replace( '%\s*[-_\s]+\s*%', ' ', $image_title );
// Sanitize the title: capitalize first letter of eve... | The meta\_query argument takes an array of arrays.
```
'meta_query' => array(
array(
'key' => 'city',
'value' => 'true',
'compare' => 'NOT LIKE',
)
)
``` |
351,582 | <p>Our store sells software and we're adding a software voucher code to each purchased. Once the purchase is completed (via the <code>woocommerce_payment_complete</code> hook) we generate the voucher code and add it to each item purchased via <a href="https://docs.woocommerce.com/wc-apidocs/function-wc_add_order_item_m... | [
{
"answer_id": 351969,
"author": "Ryan",
"author_id": 144151,
"author_profile": "https://wordpress.stackexchange.com/users/144151",
"pm_score": 3,
"selected": true,
"text": "<p>Since this isn't getting much action I'll put our <em>band-aid</em> fix as the current solution.</p>\n\n<p><str... | 2019/10/30 | [
"https://wordpress.stackexchange.com/questions/351582",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/144151/"
] | Our store sells software and we're adding a software voucher code to each purchased. Once the purchase is completed (via the `woocommerce_payment_complete` hook) we generate the voucher code and add it to each item purchased via [wc\_add\_order\_item\_meta](https://docs.woocommerce.com/wc-apidocs/function-wc_add_order_... | Since this isn't getting much action I'll put our *band-aid* fix as the current solution.
**Problem 1 Solution**
The added item meta data shows on the order confirmation page and does not show on the confirmation email. We solved this by utilizing the `woocommerce_order_item_meta_end` hook to add the extra item met... |
351,718 | <p>I am trying to display recent posts where I have one on the left showing the image, title, excerpt and author info and on the right, just the title, date and author information. I want it to show the remaining info in the right column (stacked on one another). So far I have the one recent post on the left and the ne... | [
{
"answer_id": 351719,
"author": "Orbital",
"author_id": 28956,
"author_profile": "https://wordpress.stackexchange.com/users/28956",
"pm_score": 2,
"selected": true,
"text": "<p>Try this</p>\n\n<pre><code><div class=\"row\">\n\n <?php \n\n $args = array(\n 'post... | 2019/11/02 | [
"https://wordpress.stackexchange.com/questions/351718",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/174342/"
] | I am trying to display recent posts where I have one on the left showing the image, title, excerpt and author info and on the right, just the title, date and author information. I want it to show the remaining info in the right column (stacked on one another). So far I have the one recent post on the left and the next ... | Try this
```
<div class="row">
<?php
$args = array(
'post_type' => 'post',
'posts_per_page' => 3
);
$counter = 0;
$_posts = new WP_Query($args);
?>
<?php if( $_posts->have_posts() ) : ?>
<?php while ( $_posts->have_posts() ) : $_posts->the_post()... |
351,725 | <p>Currently I’m having URL for pagination pages as:</p>
<p><a href="http://www.example.com/category_name/page/2" rel="nofollow noreferrer">http://www.example.com/category_name/page/2</a></p>
<p>But I need to change this URL structure as:</p>
<p><a href="http://www.example.com/category_name/?page=2" rel="nofollow no... | [
{
"answer_id": 351719,
"author": "Orbital",
"author_id": 28956,
"author_profile": "https://wordpress.stackexchange.com/users/28956",
"pm_score": 2,
"selected": true,
"text": "<p>Try this</p>\n\n<pre><code><div class=\"row\">\n\n <?php \n\n $args = array(\n 'post... | 2019/11/02 | [
"https://wordpress.stackexchange.com/questions/351725",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/177740/"
] | Currently I’m having URL for pagination pages as:
<http://www.example.com/category_name/page/2>
But I need to change this URL structure as:
<http://www.example.com/category_name/?page=2>
etc.
any solution? | Try this
```
<div class="row">
<?php
$args = array(
'post_type' => 'post',
'posts_per_page' => 3
);
$counter = 0;
$_posts = new WP_Query($args);
?>
<?php if( $_posts->have_posts() ) : ?>
<?php while ( $_posts->have_posts() ) : $_posts->the_post()... |
351,787 | <p>Adapting some old SEO module (which was written for TinyMCE), I have to access the current post title and post content via JavaScript. I have been avoiding Gutenberg in the past, but it seems like this will be no longer possible.</p>
<p>Within the old SEO module there are the following lines in the <code>admin.js</c... | [
{
"answer_id": 351788,
"author": "Tom J Nowell",
"author_id": 736,
"author_profile": "https://wordpress.stackexchange.com/users/736",
"pm_score": 3,
"selected": true,
"text": "<p>If we do this in the browser dev tools console:</p>\n<pre class=\"lang-js prettyprint-override\"><code>var b ... | 2019/11/03 | [
"https://wordpress.stackexchange.com/questions/351787",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/12035/"
] | Adapting some old SEO module (which was written for TinyMCE), I have to access the current post title and post content via JavaScript. I have been avoiding Gutenberg in the past, but it seems like this will be no longer possible.
Within the old SEO module there are the following lines in the `admin.js`:
```
var title... | If we do this in the browser dev tools console:
```js
var b = wp.data.select("core/editor");
```
We can then inspect the `b` variable to see what functions it exposes via autocomplete, or debugging tools.
Notice, I didn't call `getBlocks()`, the post title has never been a part of the post content, why would that c... |
351,804 | <p>I'd like to hide the "add to cart" & price for WooCommerce products in the 'Services' category.</p>
<p>I've tried the following code in my child theme's functions.php, but <a href="https://pureblissmoonhealer.com/product-category/services/" rel="nofollow noreferrer">https://pureblissmoonhealer.com/product-categ... | [
{
"answer_id": 351788,
"author": "Tom J Nowell",
"author_id": 736,
"author_profile": "https://wordpress.stackexchange.com/users/736",
"pm_score": 3,
"selected": true,
"text": "<p>If we do this in the browser dev tools console:</p>\n<pre class=\"lang-js prettyprint-override\"><code>var b ... | 2019/11/04 | [
"https://wordpress.stackexchange.com/questions/351804",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/147186/"
] | I'd like to hide the "add to cart" & price for WooCommerce products in the 'Services' category.
I've tried the following code in my child theme's functions.php, but <https://pureblissmoonhealer.com/product-category/services/> still displays "add to cart" & price.
Help appreciated.
```
function insight_hide_price_add... | If we do this in the browser dev tools console:
```js
var b = wp.data.select("core/editor");
```
We can then inspect the `b` variable to see what functions it exposes via autocomplete, or debugging tools.
Notice, I didn't call `getBlocks()`, the post title has never been a part of the post content, why would that c... |
351,932 | <p>Last week I added WooCommerce and YITH (catalog mode). All seemed fine. Today, I log in and I no longer see (in the left admin sidebar) the following items/tools:</p>
<ul>
<li>‘Appearance’ (with theme and such)</li>
<li>Plugins</li>
<li>WooCommerce</li>
<li>user Admin</li>
<li>Theme admin </li>
<li>(maybe more, but... | [
{
"answer_id": 351788,
"author": "Tom J Nowell",
"author_id": 736,
"author_profile": "https://wordpress.stackexchange.com/users/736",
"pm_score": 3,
"selected": true,
"text": "<p>If we do this in the browser dev tools console:</p>\n<pre class=\"lang-js prettyprint-override\"><code>var b ... | 2019/11/05 | [
"https://wordpress.stackexchange.com/questions/351932",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/177895/"
] | Last week I added WooCommerce and YITH (catalog mode). All seemed fine. Today, I log in and I no longer see (in the left admin sidebar) the following items/tools:
* ‘Appearance’ (with theme and such)
* Plugins
* WooCommerce
* user Admin
* Theme admin
* (maybe more, but those I remember using before and they are all go... | If we do this in the browser dev tools console:
```js
var b = wp.data.select("core/editor");
```
We can then inspect the `b` variable to see what functions it exposes via autocomplete, or debugging tools.
Notice, I didn't call `getBlocks()`, the post title has never been a part of the post content, why would that c... |
351,967 | <p>Im using this function to add button "Order again" in actions</p>
<pre><code>function cs_add_order_again_to_my_orders_actions( $actions, $order ) {
$payment_method = method_exists($order, 'get_payment_method') ? $order->get_payment_method() : $order->payment_method;
if ($payment_method === 'cod') {
... | [
{
"answer_id": 351788,
"author": "Tom J Nowell",
"author_id": 736,
"author_profile": "https://wordpress.stackexchange.com/users/736",
"pm_score": 3,
"selected": true,
"text": "<p>If we do this in the browser dev tools console:</p>\n<pre class=\"lang-js prettyprint-override\"><code>var b ... | 2019/11/05 | [
"https://wordpress.stackexchange.com/questions/351967",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/75829/"
] | Im using this function to add button "Order again" in actions
```
function cs_add_order_again_to_my_orders_actions( $actions, $order ) {
$payment_method = method_exists($order, 'get_payment_method') ? $order->get_payment_method() : $order->payment_method;
if ($payment_method === 'cod') {
$actions['orde... | If we do this in the browser dev tools console:
```js
var b = wp.data.select("core/editor");
```
We can then inspect the `b` variable to see what functions it exposes via autocomplete, or debugging tools.
Notice, I didn't call `getBlocks()`, the post title has never been a part of the post content, why would that c... |
351,985 | <p>I would like to ask how to remove < h1 class="page-title"> in the product page?</p>
<p><a href="https://i.stack.imgur.com/4JXDO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4JXDO.png" alt="h1 page title"></a></p>
<p>Here's my sample link: <a href="https://pwbackup.panelwallart.com/products... | [
{
"answer_id": 351987,
"author": "entreprenerds",
"author_id": 177856,
"author_profile": "https://wordpress.stackexchange.com/users/177856",
"pm_score": 1,
"selected": false,
"text": "<p>There are two ways of doing this - with hooks, or by overriding the WooCommerce template file in your... | 2019/11/06 | [
"https://wordpress.stackexchange.com/questions/351985",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/177921/"
] | I would like to ask how to remove < h1 class="page-title"> in the product page?
[](https://i.stack.imgur.com/4JXDO.png)
Here's my sample link: <https://pwbackup.panelwallart.com/products/colorful-world-map-on-old-wall-canvas-prints-panel-wall-art/>
It seems that t... | There are two ways of doing this - with hooks, or by overriding the WooCommerce template file in your Child theme. First, let's look at the file override:
**Method 1 - File Override**
From the WooCommerce plugin folder, copy the `templates/single-product/title.php` file, and paste it into your active theme under `woo... |
351,989 | <p>I registered a custom post type "job" to create job board site. Without a plugin, how can I make the posts auto change status to pending after 90 days? I am new in WordPress & <code>PHP</code>. I tried some solutions found on the internet, but not working.</p>
<p>Sorry that I don't really good in <code>PHP</cod... | [
{
"answer_id": 351996,
"author": "Pratikb.Simform",
"author_id": 173473,
"author_profile": "https://wordpress.stackexchange.com/users/173473",
"pm_score": 0,
"selected": false,
"text": "<p>Try Below code in your functions.php</p>\n\n<pre><code>function expire_posts() {\n global $wpdb;\n... | 2019/11/06 | [
"https://wordpress.stackexchange.com/questions/351989",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/155162/"
] | I registered a custom post type "job" to create job board site. Without a plugin, how can I make the posts auto change status to pending after 90 days? I am new in WordPress & `PHP`. I tried some solutions found on the internet, but not working.
Sorry that I don't really good in `PHP`, I can't write code myself. For t... | This is one of those questions that seem easy enough, but are actually quite complicated. If you don't want to use an existing plugin, you'll have to write your own (and hence learn more `php` as this is not a please-write-my-code-for-free-site). Here's an outline.
First you will need to [select all the posts](https:/... |
351,995 | <p>I am trying to load a CSS Stylesheet to ONLY the "about" page. </p>
<p>I think I am 99% correct but what is wrong is the <code>plugins_url</code> - to link to the theme folder where I keep my <code>CSS</code> can I just use simply:</p>
<pre><code>function testimonial_style() {
wp_enqueue_style( 'custom_tooltip_f... | [
{
"answer_id": 351998,
"author": "Nitesh Moree",
"author_id": 148022,
"author_profile": "https://wordpress.stackexchange.com/users/148022",
"pm_score": 3,
"selected": true,
"text": "<p>Try this: \nI hope, It will works.</p>\n\n<p><strong>Explaination:</strong></p>\n\n<p>In below code in ... | 2019/11/06 | [
"https://wordpress.stackexchange.com/questions/351995",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/93691/"
] | I am trying to load a CSS Stylesheet to ONLY the "about" page.
I think I am 99% correct but what is wrong is the `plugins_url` - to link to the theme folder where I keep my `CSS` can I just use simply:
```
function testimonial_style() {
wp_enqueue_style( 'custom_tooltip_frontend_css', url('path-to-my.css') );
}
... | Try this:
I hope, It will works.
**Explaination:**
In below code in **"is\_page( 42 )"** where 42 is page id of **about page**. So, if about page's id will be 42 then it's enqueue the stylesheet for that page only.
Also I define particular path for this CSS file by using wordpress function **get\_template\_director... |
352,030 | <p>I'm trying to modify the inbuilt WordPress category widget to only show categories if they have children. </p>
<p>I was using this code: </p>
<pre><code>function exclude_widget_subcategories($args){
$all_categories = get_all_category_ids();
$exclude_categories = array();
foreach($all_categories as $categor... | [
{
"answer_id": 352013,
"author": "Shadow",
"author_id": 174860,
"author_profile": "https://wordpress.stackexchange.com/users/174860",
"pm_score": 1,
"selected": false,
"text": "<p>It's not the right way to delete tables from the database when you deactivate the plugin because there are m... | 2019/11/06 | [
"https://wordpress.stackexchange.com/questions/352030",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/132427/"
] | I'm trying to modify the inbuilt WordPress category widget to only show categories if they have children.
I was using this code:
```
function exclude_widget_subcategories($args){
$all_categories = get_all_category_ids();
$exclude_categories = array();
foreach($all_categories as $category_id){
$category ... | In my opinion, a best practice would be to clean everything on uninstallation. It's also mentioned as a best practice [in the docs](https://developer.wordpress.org/plugins/plugin-basics/uninstall-methods/):
>
> When your plugin is uninstalled, you’ll want to clear out any plugin options and/or settings specific to to... |
352,077 | <p>When you add a meta box to Gutenberg, it looks different than the other items in the editor. There is a HR, and the fonts are different.</p>
<p><a href="https://i.stack.imgur.com/DW1qe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DW1qe.png" alt="enter image description here"></a></p>
<p>Does ... | [
{
"answer_id": 352079,
"author": "Jacob Peattie",
"author_id": 39152,
"author_profile": "https://wordpress.stackexchange.com/users/39152",
"pm_score": 2,
"selected": false,
"text": "<p>In your example, Discussion is not a meta box. Meta boxes are not a native part of the block editor, an... | 2019/11/07 | [
"https://wordpress.stackexchange.com/questions/352077",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/131224/"
] | When you add a meta box to Gutenberg, it looks different than the other items in the editor. There is a HR, and the fonts are different.
[](https://i.stack.imgur.com/DW1qe.png)
Does anyone know how to fix this so it looks like a natural part of the s... | Bottom border (HR) can be removed using CSS:
```
#__BLOCK_ID__.postbox:not(.closed) .postbox-header{
border-bottom: none;
}
```
p.s. change `__BLOCK_ID__` to first parameter used in `add_meta_box()` function. |
352,087 | <p>In start of every month WP creating folder with month number, like /uploads/2019/11, and it's creating with ROOT, so I dont have permission to write it. If I delete it, and then it's creating when I uploading smth - it's ok.
So problem only in this AUTOCREATE folder every 1st day of month. How can I disable it? I ca... | [
{
"answer_id": 352079,
"author": "Jacob Peattie",
"author_id": 39152,
"author_profile": "https://wordpress.stackexchange.com/users/39152",
"pm_score": 2,
"selected": false,
"text": "<p>In your example, Discussion is not a meta box. Meta boxes are not a native part of the block editor, an... | 2019/11/07 | [
"https://wordpress.stackexchange.com/questions/352087",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/177998/"
] | In start of every month WP creating folder with month number, like /uploads/2019/11, and it's creating with ROOT, so I dont have permission to write it. If I delete it, and then it's creating when I uploading smth - it's ok.
So problem only in this AUTOCREATE folder every 1st day of month. How can I disable it? I cant ... | Bottom border (HR) can be removed using CSS:
```
#__BLOCK_ID__.postbox:not(.closed) .postbox-header{
border-bottom: none;
}
```
p.s. change `__BLOCK_ID__` to first parameter used in `add_meta_box()` function. |
352,130 | <p>I had a drupal site for many years that crashed. I thought I lost all my files, but I was able to download an enormous amount from the Wayback Machine. Now the question is, how do I move those files and get the old articles live on my WordPress site? I did find a plugin for a Drupal to WordPress migration, but it se... | [
{
"answer_id": 352079,
"author": "Jacob Peattie",
"author_id": 39152,
"author_profile": "https://wordpress.stackexchange.com/users/39152",
"pm_score": 2,
"selected": false,
"text": "<p>In your example, Discussion is not a meta box. Meta boxes are not a native part of the block editor, an... | 2019/11/07 | [
"https://wordpress.stackexchange.com/questions/352130",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/178031/"
] | I had a drupal site for many years that crashed. I thought I lost all my files, but I was able to download an enormous amount from the Wayback Machine. Now the question is, how do I move those files and get the old articles live on my WordPress site? I did find a plugin for a Drupal to WordPress migration, but it seems... | Bottom border (HR) can be removed using CSS:
```
#__BLOCK_ID__.postbox:not(.closed) .postbox-header{
border-bottom: none;
}
```
p.s. change `__BLOCK_ID__` to first parameter used in `add_meta_box()` function. |
352,134 | <p><strong>Note:</strong> I'm adding information I discover that seems to be leading to a resolution in the note.</p>
<h1>The Problem:</h1>
<p><strong>When pasting content from a source external to Gutenberg into Gutenberg some HTML/CSS formatting is lost.[1]</strong> While Gutenberg retains most HTML (semantic) elem... | [
{
"answer_id": 352079,
"author": "Jacob Peattie",
"author_id": 39152,
"author_profile": "https://wordpress.stackexchange.com/users/39152",
"pm_score": 2,
"selected": false,
"text": "<p>In your example, Discussion is not a meta box. Meta boxes are not a native part of the block editor, an... | 2019/11/07 | [
"https://wordpress.stackexchange.com/questions/352134",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43881/"
] | **Note:** I'm adding information I discover that seems to be leading to a resolution in the note.
The Problem:
============
**When pasting content from a source external to Gutenberg into Gutenberg some HTML/CSS formatting is lost.[1]** While Gutenberg retains most HTML (semantic) elements it drops CSS (styling/non-s... | Bottom border (HR) can be removed using CSS:
```
#__BLOCK_ID__.postbox:not(.closed) .postbox-header{
border-bottom: none;
}
```
p.s. change `__BLOCK_ID__` to first parameter used in `add_meta_box()` function. |
352,140 | <p>I am developing a plugin by using classes and object oriented programming.</p>
<p>Within my plugin I have included another object as I need to use the functionality of this other object.</p>
<p>I am instantiating the included object within my plugin's constructor.</p>
<pre><code>require_once ('path/to/my/Included... | [
{
"answer_id": 352141,
"author": "Tom J Nowell",
"author_id": 736,
"author_profile": "https://wordpress.stackexchange.com/users/736",
"pm_score": 4,
"selected": true,
"text": "<p>The root of your problem is not object oriented programming, but a fundamental misunderstanding about how PHP... | 2019/11/08 | [
"https://wordpress.stackexchange.com/questions/352140",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/63540/"
] | I am developing a plugin by using classes and object oriented programming.
Within my plugin I have included another object as I need to use the functionality of this other object.
I am instantiating the included object within my plugin's constructor.
```
require_once ('path/to/my/IncludedObject');
class MyPlugin
{
... | The root of your problem is not object oriented programming, but a fundamental misunderstanding about how PHP handles requests.
If this were a Java or a Node application for example, you would start the application on the server, and it would recieve requests, and respond. It's a continuous active program. As a result... |
352,142 | <p>I'm testing WordPress 5.3 (<em>5.3-RC4-46673</em>) with my theme. I have <code>WP_DEBUG</code> enabled. I notice the following error in the dashboard now:</p>
<blockquote>
<p>Notice: add_submenu_page was called incorrectly. The seventh parameter passed to add_submenu_page() should be an integer representing menu ... | [
{
"answer_id": 352147,
"author": "yannibmbr",
"author_id": 56791,
"author_profile": "https://wordpress.stackexchange.com/users/56791",
"pm_score": 2,
"selected": false,
"text": "<p>I was able to track this down to the culprit function <code>add_theme_page()</code>. There</p>\n<p>There wa... | 2019/11/08 | [
"https://wordpress.stackexchange.com/questions/352142",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/56791/"
] | I'm testing WordPress 5.3 (*5.3-RC4-46673*) with my theme. I have `WP_DEBUG` enabled. I notice the following error in the dashboard now:
>
> Notice: add\_submenu\_page was called incorrectly. The seventh parameter passed to add\_submenu\_page() should be an integer representing menu position. Please see Debugging in ... | I was able to track this down to the culprit function `add_theme_page()`. There
There was an additional parameter, per [the codex for add\_theme\_page()](https://developer.wordpress.org/reference/functions/add_theme_page/) that needed to be removed. Removing that seemed to help.
```
function fivehundred_register_admi... |
352,198 | <p>I have added an acf image gallery for archive terms and I would like to take those images and insert one image from the gallery every 3 posts in the term archive. This is what I have so far but I am not yet getting them to distribute sequentially every 3 posts. </p>
<p>1-2-3 posts<br>
Image 1<br>
4-5-6 posts<br>
Im... | [
{
"answer_id": 352147,
"author": "yannibmbr",
"author_id": 56791,
"author_profile": "https://wordpress.stackexchange.com/users/56791",
"pm_score": 2,
"selected": false,
"text": "<p>I was able to track this down to the culprit function <code>add_theme_page()</code>. There</p>\n<p>There wa... | 2019/11/08 | [
"https://wordpress.stackexchange.com/questions/352198",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/178078/"
] | I have added an acf image gallery for archive terms and I would like to take those images and insert one image from the gallery every 3 posts in the term archive. This is what I have so far but I am not yet getting them to distribute sequentially every 3 posts.
1-2-3 posts
Image 1
4-5-6 posts
Image 2
7-8-... | I was able to track this down to the culprit function `add_theme_page()`. There
There was an additional parameter, per [the codex for add\_theme\_page()](https://developer.wordpress.org/reference/functions/add_theme_page/) that needed to be removed. Removing that seemed to help.
```
function fivehundred_register_admi... |
352,323 | <p>This method for @SE <a href="https://wordpress.stackexchange.com/questions/319035/how-would-i-get-a-taxonomy-category-list-inside-a-gutenberg-block/336924#336924">How would I get a taxonomy/category list inside a Gutenberg block?</a> does NOT work for custom taxonomies, e.g.:</p>
<pre><code>wp.data.select('core').g... | [
{
"answer_id": 352331,
"author": "Digitalle",
"author_id": 124083,
"author_profile": "https://wordpress.stackexchange.com/users/124083",
"pm_score": 1,
"selected": false,
"text": "<p><strong>ANSWER UPDATE:</strong> IF you have a large number of terms within your taxonomy, i.e. more than ... | 2019/11/11 | [
"https://wordpress.stackexchange.com/questions/352323",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/124083/"
] | This method for @SE [How would I get a taxonomy/category list inside a Gutenberg block?](https://wordpress.stackexchange.com/questions/319035/how-would-i-get-a-taxonomy-category-list-inside-a-gutenberg-block/336924#336924) does NOT work for custom taxonomies, e.g.:
```
wp.data.select('core').getEntityRecords('taxonomy... | 1. The `getEntityRecords()` method [uses the REST API](https://github.com/WordPress/gutenberg/blob/04e142e9cbd06a45c4ea297ec573d389955c13be/packages/core-data/src/resolvers.js#L60), so make sure the taxonomy is enabled for the REST API. You can enable it via the `show_in_rest` parameter when registering the taxonomy us... |
352,354 | <p>Hello would anybody be able to help my situation? at this point I'm wondering if it is a database issue because when i try the alternative to drag and drop an image into my media library i get this error-" could not insert post into the database". the hello? i have the permissions set up correct upload folder set to... | [
{
"answer_id": 352331,
"author": "Digitalle",
"author_id": 124083,
"author_profile": "https://wordpress.stackexchange.com/users/124083",
"pm_score": 1,
"selected": false,
"text": "<p><strong>ANSWER UPDATE:</strong> IF you have a large number of terms within your taxonomy, i.e. more than ... | 2019/11/12 | [
"https://wordpress.stackexchange.com/questions/352354",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/178184/"
] | Hello would anybody be able to help my situation? at this point I'm wondering if it is a database issue because when i try the alternative to drag and drop an image into my media library i get this error-" could not insert post into the database". the hello? i have the permissions set up correct upload folder set to 74... | 1. The `getEntityRecords()` method [uses the REST API](https://github.com/WordPress/gutenberg/blob/04e142e9cbd06a45c4ea297ec573d389955c13be/packages/core-data/src/resolvers.js#L60), so make sure the taxonomy is enabled for the REST API. You can enable it via the `show_in_rest` parameter when registering the taxonomy us... |
352,413 | <p>I'm trying to override this Dokan plugin file in a child theme:</p>
<pre><code>wp-content/plugins/dokan-pro/includes/modules/vendor-verification/templates/verification-new.php
</code></pre>
<p>I can successfully override files in the normal Dokan templates folder:</p>
<pre><code>wp-content/plugins/dokan-pro/templ... | [
{
"answer_id": 352415,
"author": "Tom J Nowell",
"author_id": 736,
"author_profile": "https://wordpress.stackexchange.com/users/736",
"pm_score": 2,
"selected": false,
"text": "<p>Child themes let you override templates, but these are not templates you're attempting to override. You can'... | 2019/11/12 | [
"https://wordpress.stackexchange.com/questions/352413",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/174394/"
] | I'm trying to override this Dokan plugin file in a child theme:
```
wp-content/plugins/dokan-pro/includes/modules/vendor-verification/templates/verification-new.php
```
I can successfully override files in the normal Dokan templates folder:
```
wp-content/plugins/dokan-pro/templates/path-to-file.php
```
by using
... | Child themes let you override templates, but these are not templates you're attempting to override. You can't drop in arbitrary files and override the parent theme, and WordPress can't do it's magic when `include` or `require` are used to load files.
The reason this works for templates, is because WordPress doesn't lo... |
352,429 | <p>Specifically, I'm trying to get get the 'Layout Group' of a given ThemeREX Custom Layout (which as I understand is just a Custom Post Type), but am also interested in seeing what other properties are available for that post.</p>
<p>I tried</p>
<pre><code>print_r(get_post_meta(get_post(1738, 'ARRAY_A', 'display'),"... | [
{
"answer_id": 352431,
"author": "Cas Dekkers",
"author_id": 153884,
"author_profile": "https://wordpress.stackexchange.com/users/153884",
"pm_score": 0,
"selected": false,
"text": "<p>Try:</p>\n\n<pre><code>print_r( get_post_type_object( ( get_post( 1738 ) )->post_type ) );\n</code><... | 2019/11/12 | [
"https://wordpress.stackexchange.com/questions/352429",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/118789/"
] | Specifically, I'm trying to get get the 'Layout Group' of a given ThemeREX Custom Layout (which as I understand is just a Custom Post Type), but am also interested in seeing what other properties are available for that post.
I tried
```
print_r(get_post_meta(get_post(1738, 'ARRAY_A', 'display'),"",true));
```
but a... | To get **all** the `post_meta` for a post, use:
```
$postmeta = get_post_meta(1738);
print_r($postmeta);
```
...which will give you a nested array of values that you can explore.
Once you've worked out what you need, you can get the individual setting / property / meta with:
```
$mySetting = get_post_meta(1738, "m... |
352,442 | <p>If I run this code I get the desired result</p>
<pre><code><?php
$terms = get_terms( 'call-type' );
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
foreach ( $terms as $term ) {
echo '\'' . $term->name . '\', ';
}
}
?>
</code></pre>
<p><strong>result</strong></p>
<p>'All', 'C... | [
{
"answer_id": 352447,
"author": "WP Updoot",
"author_id": 173692,
"author_profile": "https://wordpress.stackexchange.com/users/173692",
"pm_score": 1,
"selected": false,
"text": "<p>What you'd need to do is double-escape, so change <code>echo '\\'' . $term->name . '\\', ';</code> to ... | 2019/11/13 | [
"https://wordpress.stackexchange.com/questions/352442",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/151521/"
] | If I run this code I get the desired result
```
<?php
$terms = get_terms( 'call-type' );
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
foreach ( $terms as $term ) {
echo '\'' . $term->name . '\', ';
}
}
?>
```
**result**
'All', 'Completed', 'In progress', 'New',
But if I put the same code in... | What you'd need to do is double-escape, so change `echo '\'' . $term->name . '\', ';` to `echo '\\\'' . $term->name . '\\\', ';`
...but, you'd be much better off just using different encapsulators:
```
<select class="w-100" name="mf_term">
<option value="
<?php
$terms = get_terms( 'call-type' );
if ( ! empty( $terms ... |
352,472 | <p>Good day . So today i've updated my wordpress version to 5.3 and after that i started to see this error at the top of all my pages . </p>
<blockquote>
<p>Warning: Declaration of QuietSkin::feedback($string) should be compatible with WP_Upgrader_Skin::feedback($string, ...$args) in /home/.../domains/.../public_htm... | [
{
"answer_id": 352479,
"author": "Ben",
"author_id": 178276,
"author_profile": "https://wordpress.stackexchange.com/users/178276",
"pm_score": 1,
"selected": false,
"text": "<p>If anyone encounters this warning and cannot hide it with changing the line in wp-config.php from true to false... | 2019/11/13 | [
"https://wordpress.stackexchange.com/questions/352472",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/178273/"
] | Good day . So today i've updated my wordpress version to 5.3 and after that i started to see this error at the top of all my pages .
>
> Warning: Declaration of QuietSkin::feedback($string) should be compatible with WP\_Upgrader\_Skin::feedback($string, ...$args) in /home/.../domains/.../public\_html/wp-content/plug... | If anyone encounters this warning and cannot hide it with changing the line in wp-config.php from true to false , replace `define('WP_DEBUG', false);` or `define('WP_DEBUG', true);`
with this :
```
ini_set('display_errors','Off');
ini_set('error_reporting', E_ALL );
define('WP_DEBUG', false);
define('WP_DEBUG_DISPLAY... |
352,512 | <p>I am trying to hide the comments form if a user has left a comment on that particular post, otherwise display the comment form. </p>
<p>I added a code snippet to a hook which hides the form, but reverts to the WordPress comment form. I'm unable to figure out how to hide that form! I would also be open to hiding tha... | [
{
"answer_id": 352479,
"author": "Ben",
"author_id": 178276,
"author_profile": "https://wordpress.stackexchange.com/users/178276",
"pm_score": 1,
"selected": false,
"text": "<p>If anyone encounters this warning and cannot hide it with changing the line in wp-config.php from true to false... | 2019/11/13 | [
"https://wordpress.stackexchange.com/questions/352512",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/178299/"
] | I am trying to hide the comments form if a user has left a comment on that particular post, otherwise display the comment form.
I added a code snippet to a hook which hides the form, but reverts to the WordPress comment form. I'm unable to figure out how to hide that form! I would also be open to hiding that entire c... | If anyone encounters this warning and cannot hide it with changing the line in wp-config.php from true to false , replace `define('WP_DEBUG', false);` or `define('WP_DEBUG', true);`
with this :
```
ini_set('display_errors','Off');
ini_set('error_reporting', E_ALL );
define('WP_DEBUG', false);
define('WP_DEBUG_DISPLAY... |
352,526 | <p>Is there a built-in Wordpress function that will allow you to enqueue all stylesheets for a particular theme?</p>
<p>I have a directory structure that looks like:</p>
<pre><code>-my-custom-theme
-css
-header.css
-footer.css
-functions.php
</code></pre>
<p>I want to load all CSS files found... | [
{
"answer_id": 352479,
"author": "Ben",
"author_id": 178276,
"author_profile": "https://wordpress.stackexchange.com/users/178276",
"pm_score": 1,
"selected": false,
"text": "<p>If anyone encounters this warning and cannot hide it with changing the line in wp-config.php from true to false... | 2019/11/14 | [
"https://wordpress.stackexchange.com/questions/352526",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/167796/"
] | Is there a built-in Wordpress function that will allow you to enqueue all stylesheets for a particular theme?
I have a directory structure that looks like:
```
-my-custom-theme
-css
-header.css
-footer.css
-functions.php
```
I want to load all CSS files found in the `my-custom-theme/css` fol... | If anyone encounters this warning and cannot hide it with changing the line in wp-config.php from true to false , replace `define('WP_DEBUG', false);` or `define('WP_DEBUG', true);`
with this :
```
ini_set('display_errors','Off');
ini_set('error_reporting', E_ALL );
define('WP_DEBUG', false);
define('WP_DEBUG_DISPLAY... |
352,543 | <p>I'm pretty new to PHP however have managed to put together a site I'm happy with.
Once small issue I am having is that I would like to add content for users with specific roles, this means adding an if statement in the middle of a pre existing one for me.</p>
<p>Below is my current code:</p>
<pre><code><?php gl... | [
{
"answer_id": 352542,
"author": "Siddhesh Shirodkar",
"author_id": 163787,
"author_profile": "https://wordpress.stackexchange.com/users/163787",
"pm_score": 2,
"selected": false,
"text": "<p>It is always best to avoid the use of plugins as it is simply an overhead on server resources. I... | 2019/11/14 | [
"https://wordpress.stackexchange.com/questions/352543",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/178319/"
] | I'm pretty new to PHP however have managed to put together a site I'm happy with.
Once small issue I am having is that I would like to add content for users with specific roles, this means adding an if statement in the middle of a pre existing one for me.
Below is my current code:
```
<?php global $current_user; wp_g... | >
> It is always best to avoid the use of plugins as it is simply an overhead on server resources. I strongly recommend that you use header.php or functions.php for adding the code.
>
>
>
This is not true.
In the end, it all comes down to PHP code. If the code lives in a plugin, a theme, functions.php or you manu... |
352,559 | <p>The Block Editor recently introduced block styles as seen below:</p>
<p><a href="https://i.stack.imgur.com/Nglqs.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Nglqs.png" alt="Block Styles"></a></p>
<p>How do we disable these?</p>
| [
{
"answer_id": 352560,
"author": "Christine Cooper",
"author_id": 24875,
"author_profile": "https://wordpress.stackexchange.com/users/24875",
"pm_score": 5,
"selected": true,
"text": "<p>We start off by finding out which block styles exists via <code>.getBlockTypes()</code>. This will du... | 2019/11/14 | [
"https://wordpress.stackexchange.com/questions/352559",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/24875/"
] | The Block Editor recently introduced block styles as seen below:
[](https://i.stack.imgur.com/Nglqs.png)
How do we disable these? | We start off by finding out which block styles exists via `.getBlockTypes()`. This will dump it into the console:
```
wp.domReady(() => {
// find blocks styles
wp.blocks.getBlockTypes().forEach((block) => {
if (_.isArray(block['styles'])) {
console.log(block.name, _.pluck(block['styles'], '... |
352,584 | <p>A plugin created lots of posts that I now need to delete.
They are targetable by category (e.g. <code>Tweet</code>). Many also have attached images.</p>
<p>I wrote a php script for it*, but without pagination it gets hung up, as it does a lot of work (deletes the posts one by one). - And with pagination (say 1000 p... | [
{
"answer_id": 352560,
"author": "Christine Cooper",
"author_id": 24875,
"author_profile": "https://wordpress.stackexchange.com/users/24875",
"pm_score": 5,
"selected": true,
"text": "<p>We start off by finding out which block styles exists via <code>.getBlockTypes()</code>. This will du... | 2019/11/14 | [
"https://wordpress.stackexchange.com/questions/352584",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/117836/"
] | A plugin created lots of posts that I now need to delete.
They are targetable by category (e.g. `Tweet`). Many also have attached images.
I wrote a php script for it\*, but without pagination it gets hung up, as it does a lot of work (deletes the posts one by one). - And with pagination (say 1000 per page) it still ta... | We start off by finding out which block styles exists via `.getBlockTypes()`. This will dump it into the console:
```
wp.domReady(() => {
// find blocks styles
wp.blocks.getBlockTypes().forEach((block) => {
if (_.isArray(block['styles'])) {
console.log(block.name, _.pluck(block['styles'], '... |
352,616 | <p>So after updating to WP 5.3 I can no longer use the file upload to choose files to add. I get the following error:</p>
<pre><code>Uncaught TypeError: Cannot convert undefined or null to object
at g.cleanup (backbone.min.js:1)
</code></pre>
<p>Error in console:
<a href="https://i.stack.imgur.com/fIz2r.png" rel=... | [
{
"answer_id": 352618,
"author": "user3574492",
"author_id": 97479,
"author_profile": "https://wordpress.stackexchange.com/users/97479",
"pm_score": 2,
"selected": true,
"text": "<p>Right, so what worked for me was upgrading my PHP version to 7.2 and that did the job.</p>\n\n<p>I was usi... | 2019/11/15 | [
"https://wordpress.stackexchange.com/questions/352616",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/97479/"
] | So after updating to WP 5.3 I can no longer use the file upload to choose files to add. I get the following error:
```
Uncaught TypeError: Cannot convert undefined or null to object
at g.cleanup (backbone.min.js:1)
```
Error in console:
[](https... | Right, so what worked for me was upgrading my PHP version to 7.2 and that did the job.
I was using 7.0 before. |
352,621 | <p>I am working on a webinar plugin that uses a custom post type to display the webinar pages. Those pages could be register, thank you, countdown, live etc. depending on the visitors registration status and the current webinar status.</p>
<p>The plugin uses the <code>template_include</code> action to render content b... | [
{
"answer_id": 353213,
"author": "Kudratullah",
"author_id": 62726,
"author_profile": "https://wordpress.stackexchange.com/users/62726",
"pm_score": 3,
"selected": true,
"text": "<p>This was a bit tricky to solve your problem.\nthe <code>template_include</code> filter executed after the ... | 2019/11/15 | [
"https://wordpress.stackexchange.com/questions/352621",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/52297/"
] | I am working on a webinar plugin that uses a custom post type to display the webinar pages. Those pages could be register, thank you, countdown, live etc. depending on the visitors registration status and the current webinar status.
The plugin uses the `template_include` action to render content based on the current p... | This was a bit tricky to solve your problem.
the `template_include` filter executed after the main query processed the current request. If you can filter the current request (query\_vars) and update it accordingly then WordPress will display any post/page you wanted to... Simply filter the `query_vars` with the `reques... |
352,669 | <p>The code below displays product category names, links and their thumbnails on hover. The thumbnails ($image) retrieved are those manually set via the woocommerce product category menu. </p>
<p>I am trying to instead, get these product category thumbnails from the best selling product in each. Im really not sure how... | [
{
"answer_id": 353213,
"author": "Kudratullah",
"author_id": 62726,
"author_profile": "https://wordpress.stackexchange.com/users/62726",
"pm_score": 3,
"selected": true,
"text": "<p>This was a bit tricky to solve your problem.\nthe <code>template_include</code> filter executed after the ... | 2019/11/16 | [
"https://wordpress.stackexchange.com/questions/352669",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/174773/"
] | The code below displays product category names, links and their thumbnails on hover. The thumbnails ($image) retrieved are those manually set via the woocommerce product category menu.
I am trying to instead, get these product category thumbnails from the best selling product in each. Im really not sure how to includ... | This was a bit tricky to solve your problem.
the `template_include` filter executed after the main query processed the current request. If you can filter the current request (query\_vars) and update it accordingly then WordPress will display any post/page you wanted to... Simply filter the `query_vars` with the `reques... |
352,672 | <p>I would like to replace the <code>WordPress</code> word in title of Dashboard.</p>
<p><a href="https://i.stack.imgur.com/tLDTf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tLDTf.png" alt="enter image description here"></a></p>
<p>Original title:</p>
<pre><code>Dashboard < Site Title - Wor... | [
{
"answer_id": 352676,
"author": "Judd Dunagan",
"author_id": 178433,
"author_profile": "https://wordpress.stackexchange.com/users/178433",
"pm_score": 1,
"selected": false,
"text": "<p>If you're talking about this area</p>\n\n<p><a href=\"https://i.stack.imgur.com/wzFjv.png\" rel=\"nofo... | 2019/11/16 | [
"https://wordpress.stackexchange.com/questions/352672",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/78021/"
] | I would like to replace the `WordPress` word in title of Dashboard.
[](https://i.stack.imgur.com/tLDTf.png)
Original title:
```
Dashboard < Site Title - WordPress
```
Expected result:
```
Dashboard < Site Title - foobar
```
I tried to do this w... | You've tried correct filter - just needs to update return:
```
function my_admin_title ( $admin_title, $title ) {
return $title . ' ‹ ' . get_bloginfo( 'name' ) . ' — ' . 'foobar';
}
add_filter( 'admin_title', 'my_admin_title', 10, 2 );
```
Btw, filter above works only for logged pages, for login page needs to a... |
352,723 | <p>When I update my page I see this error and I tried to fix it but that didn't work. I removed all plugins and checked but it was still not fixed. Then I removed all themes and installed another theme but still it is not fixed. Now I am confused how to fix it. Please guide me how to fix it and why this error is showin... | [
{
"answer_id": 352751,
"author": "Rick Hellewell",
"author_id": 29416,
"author_profile": "https://wordpress.stackexchange.com/users/29416",
"pm_score": 2,
"selected": false,
"text": "<p>That may not be a valid error. But the troubleshooting link provided in a comment to your question is ... | 2019/11/17 | [
"https://wordpress.stackexchange.com/questions/352723",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/178458/"
] | When I update my page I see this error and I tried to fix it but that didn't work. I removed all plugins and checked but it was still not fixed. Then I removed all themes and installed another theme but still it is not fixed. Now I am confused how to fix it. Please guide me how to fix it and why this error is showing? | You should troubleshoot your website for plugins and WordPress Themes.
Make sure your PHP version is 7.3 or above.
As you are unable to access your WordPress admin area so please try to access your file manager in cPanel or access public\_html directory via FTP. Plugins and Themes directories are inside wp-content/ d... |
352,767 | <p>I have a form with AJAX Submit. I am getting the value of fields as null.</p>
<pre><code>jQuery('#DownloadForm').submit(ajaxSubmit);
function ajaxSubmit() {
var DownloadForm = jQuery(this).serialize();
jQuery.ajax({
type: "POST",
url: aj_ajax_demo.ajax_url,
data : {
... | [
{
"answer_id": 352751,
"author": "Rick Hellewell",
"author_id": 29416,
"author_profile": "https://wordpress.stackexchange.com/users/29416",
"pm_score": 2,
"selected": false,
"text": "<p>That may not be a valid error. But the troubleshooting link provided in a comment to your question is ... | 2019/11/18 | [
"https://wordpress.stackexchange.com/questions/352767",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/167545/"
] | I have a form with AJAX Submit. I am getting the value of fields as null.
```
jQuery('#DownloadForm').submit(ajaxSubmit);
function ajaxSubmit() {
var DownloadForm = jQuery(this).serialize();
jQuery.ajax({
type: "POST",
url: aj_ajax_demo.ajax_url,
data : {
action : 's... | You should troubleshoot your website for plugins and WordPress Themes.
Make sure your PHP version is 7.3 or above.
As you are unable to access your WordPress admin area so please try to access your file manager in cPanel or access public\_html directory via FTP. Plugins and Themes directories are inside wp-content/ d... |
352,794 | <p>I'm looking for a solution to set my <a href="https://wordpress.org/support/article/dashboard-screen/" rel="nofollow noreferrer">WordPress login page</a> as the homepage. Maybe a redirect 301 will work. Are there any other solutions?</p>
| [
{
"answer_id": 352805,
"author": "John Swaringen",
"author_id": 723,
"author_profile": "https://wordpress.stackexchange.com/users/723",
"pm_score": 2,
"selected": false,
"text": "<p>Add the following to your <code>.htaccess</code> file:</p>\n\n<pre><code># Custom default index page\nDire... | 2019/11/18 | [
"https://wordpress.stackexchange.com/questions/352794",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/82174/"
] | I'm looking for a solution to set my [WordPress login page](https://wordpress.org/support/article/dashboard-screen/) as the homepage. Maybe a redirect 301 will work. Are there any other solutions? | Add the following to your `.htaccess` file:
```
# Custom default index page
DirectoryIndex ./wp-login.php
```
That should work. |
352,896 | <p>Having an issue with my plugin updating the htaccess file. The code I used to do that is:</p>
<pre><code>insert_with_markers($htaccess_file, $marker, $lines);
</code></pre>
<p>The parameters used in that function have been previously defined properly. There error message is:</p>
<pre><code> Uncaught Error: Cal... | [
{
"answer_id": 352982,
"author": "Sally CJ",
"author_id": 137402,
"author_profile": "https://wordpress.stackexchange.com/users/137402",
"pm_score": 1,
"selected": false,
"text": "<p>From your comment:</p>\n\n<blockquote>\n <p>Those <code>htaccess</code> changes don't happen as a result ... | 2019/11/20 | [
"https://wordpress.stackexchange.com/questions/352896",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/29416/"
] | Having an issue with my plugin updating the htaccess file. The code I used to do that is:
```
insert_with_markers($htaccess_file, $marker, $lines);
```
The parameters used in that function have been previously defined properly. There error message is:
```
Uncaught Error: Call to a member function switch_to_loca... | I discovered that there was an extra '-' character just above the line that caused the error. It was hard to see in my editor (and maybe because of some dust on the screen).
The syntax checker in my editor (Rapid PHP 2018) didn't sense that error Only by looking very close did I find the extra character. Removing that... |
352,900 | <p>I'm having issues with being able to get to my image files inside the Media Library. I'm having issues, since I have transferred my WordPress website from my local server to the live environment.</p>
<p>In the below screenshot you can see the files are in the correct directory:</p>
<p>wp-content/uploads/</p>
<p><... | [
{
"answer_id": 352982,
"author": "Sally CJ",
"author_id": 137402,
"author_profile": "https://wordpress.stackexchange.com/users/137402",
"pm_score": 1,
"selected": false,
"text": "<p>From your comment:</p>\n\n<blockquote>\n <p>Those <code>htaccess</code> changes don't happen as a result ... | 2019/11/20 | [
"https://wordpress.stackexchange.com/questions/352900",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/178186/"
] | I'm having issues with being able to get to my image files inside the Media Library. I'm having issues, since I have transferred my WordPress website from my local server to the live environment.
In the below screenshot you can see the files are in the correct directory:
wp-content/uploads/
[![enter image descriptio... | I discovered that there was an extra '-' character just above the line that caused the error. It was hard to see in my editor (and maybe because of some dust on the screen).
The syntax checker in my editor (Rapid PHP 2018) didn't sense that error Only by looking very close did I find the extra character. Removing that... |
353,004 | <p>I have a problem after migrating a WordPress site from Plesk and IIS to LAMP server.</p>
<p>I cannot access the Admin Panel, I can access <code>/wp-admin/</code> and can login successfully but I get redirected to the home page and not to Admin Page.</p>
<p>If I set <code>define('WP_DEBUG', true)</code> in <code>wp... | [
{
"answer_id": 352982,
"author": "Sally CJ",
"author_id": 137402,
"author_profile": "https://wordpress.stackexchange.com/users/137402",
"pm_score": 1,
"selected": false,
"text": "<p>From your comment:</p>\n\n<blockquote>\n <p>Those <code>htaccess</code> changes don't happen as a result ... | 2019/11/21 | [
"https://wordpress.stackexchange.com/questions/353004",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/178679/"
] | I have a problem after migrating a WordPress site from Plesk and IIS to LAMP server.
I cannot access the Admin Panel, I can access `/wp-admin/` and can login successfully but I get redirected to the home page and not to Admin Page.
If I set `define('WP_DEBUG', true)` in `wp-config.php` file I get this error:
>
> No... | I discovered that there was an extra '-' character just above the line that caused the error. It was hard to see in my editor (and maybe because of some dust on the screen).
The syntax checker in my editor (Rapid PHP 2018) didn't sense that error Only by looking very close did I find the extra character. Removing that... |
353,068 | <p>I tried to find with this select statement.</p>
<pre><code>SELECT * FROM `wp_options` WHERE 'option_name' LIKE '%core_update%'
</code></pre>
<p>Zero lines result.</p>
<p>What can I do beside update by hand. I only want to use the update button instead.</p>
<p>Thanks in advance.
Hans</p>
| [
{
"answer_id": 352982,
"author": "Sally CJ",
"author_id": 137402,
"author_profile": "https://wordpress.stackexchange.com/users/137402",
"pm_score": 1,
"selected": false,
"text": "<p>From your comment:</p>\n\n<blockquote>\n <p>Those <code>htaccess</code> changes don't happen as a result ... | 2019/11/21 | [
"https://wordpress.stackexchange.com/questions/353068",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/178720/"
] | I tried to find with this select statement.
```
SELECT * FROM `wp_options` WHERE 'option_name' LIKE '%core_update%'
```
Zero lines result.
What can I do beside update by hand. I only want to use the update button instead.
Thanks in advance.
Hans | I discovered that there was an extra '-' character just above the line that caused the error. It was hard to see in my editor (and maybe because of some dust on the screen).
The syntax checker in my editor (Rapid PHP 2018) didn't sense that error Only by looking very close did I find the extra character. Removing that... |
353,090 | <p>I need to output some posts on some pages and I created shortcode:</p>
<pre><code>function show_foo() {
// output stuff
}
add_shortcode( 'foo', 'show_foo' );
</code></pre>
<p>and I use it like this in templates:</p>
<pre><code>echo do_shortcode('[foo]');
</code></pre>
<p>But now I'm thinking if I shouldn... | [
{
"answer_id": 352982,
"author": "Sally CJ",
"author_id": 137402,
"author_profile": "https://wordpress.stackexchange.com/users/137402",
"pm_score": 1,
"selected": false,
"text": "<p>From your comment:</p>\n\n<blockquote>\n <p>Those <code>htaccess</code> changes don't happen as a result ... | 2019/11/22 | [
"https://wordpress.stackexchange.com/questions/353090",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/119679/"
] | I need to output some posts on some pages and I created shortcode:
```
function show_foo() {
// output stuff
}
add_shortcode( 'foo', 'show_foo' );
```
and I use it like this in templates:
```
echo do_shortcode('[foo]');
```
But now I'm thinking if I shouldn't use action in favor of shortcode, like this:
... | I discovered that there was an extra '-' character just above the line that caused the error. It was hard to see in my editor (and maybe because of some dust on the screen).
The syntax checker in my editor (Rapid PHP 2018) didn't sense that error Only by looking very close did I find the extra character. Removing that... |
353,126 | <p>I have an up-to-date Wordpress install, and I've tried to do due diligence when it comes to security. However I'm having a recurring problem.</p>
<p>I've put my config at the level above my install location.</p>
<p>However every so often something writes a new <code>wp-config.php</code> to the install location, fi... | [
{
"answer_id": 353135,
"author": "C0c0b33f",
"author_id": 173627,
"author_profile": "https://wordpress.stackexchange.com/users/173627",
"pm_score": 0,
"selected": false,
"text": "<p>You can move your config file up one directory and should check the file permissions to only allow you, th... | 2019/11/22 | [
"https://wordpress.stackexchange.com/questions/353126",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/178765/"
] | I have an up-to-date Wordpress install, and I've tried to do due diligence when it comes to security. However I'm having a recurring problem.
I've put my config at the level above my install location.
However every so often something writes a new `wp-config.php` to the install location, filled with someone's details.... | This turned out to be really, really stupid.
Due to a mistake in the original commissioning process, there was a copy of the Wordpress install within the site, i.e. `/wordpress`, never set up. This is the sort of thing that would happen if you unpacked the install to the wrong level and then copied it upwards rather t... |
353,129 | <p>So, I am creating a shortcode to return some ACF content.</p>
<p>The following code works:</p>
<pre><code>function howitworks() {
$page = get_page_by_title('shop');
if (have_rows('steps', $page->ID)) :
while (have_rows('steps', $page->ID)) : the_row();
$image = get_sub_field('icon... | [
{
"answer_id": 353135,
"author": "C0c0b33f",
"author_id": 173627,
"author_profile": "https://wordpress.stackexchange.com/users/173627",
"pm_score": 0,
"selected": false,
"text": "<p>You can move your config file up one directory and should check the file permissions to only allow you, th... | 2019/11/22 | [
"https://wordpress.stackexchange.com/questions/353129",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/9820/"
] | So, I am creating a shortcode to return some ACF content.
The following code works:
```
function howitworks() {
$page = get_page_by_title('shop');
if (have_rows('steps', $page->ID)) :
while (have_rows('steps', $page->ID)) : the_row();
$image = get_sub_field('icon');
$i = '<div ... | This turned out to be really, really stupid.
Due to a mistake in the original commissioning process, there was a copy of the Wordpress install within the site, i.e. `/wordpress`, never set up. This is the sort of thing that would happen if you unpacked the install to the wrong level and then copied it upwards rather t... |
353,137 | <p>I'm trying to set notifications when I have products from these two different categories inside the card in <code>WooCommerce</code>.</p>
<p>This is the code which I using:</p>
<pre><code>add_action( 'woocommerce_checkout_before_customer_details', 'webroom_check_if_product_category_is_in_cart' );
function webroom_... | [
{
"answer_id": 353135,
"author": "C0c0b33f",
"author_id": 173627,
"author_profile": "https://wordpress.stackexchange.com/users/173627",
"pm_score": 0,
"selected": false,
"text": "<p>You can move your config file up one directory and should check the file permissions to only allow you, th... | 2019/11/22 | [
"https://wordpress.stackexchange.com/questions/353137",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/178581/"
] | I'm trying to set notifications when I have products from these two different categories inside the card in `WooCommerce`.
This is the code which I using:
```
add_action( 'woocommerce_checkout_before_customer_details', 'webroom_check_if_product_category_is_in_cart' );
function webroom_check_if_product_category_is_in_... | This turned out to be really, really stupid.
Due to a mistake in the original commissioning process, there was a copy of the Wordpress install within the site, i.e. `/wordpress`, never set up. This is the sort of thing that would happen if you unpacked the install to the wrong level and then copied it upwards rather t... |
353,165 | <p>Wordpress initial install. Version <code>5.3</code></p>
<blockquote>
<p>index.php</p>
</blockquote>
<pre><code><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Com... | [
{
"answer_id": 353503,
"author": "mrwpress",
"author_id": 115461,
"author_profile": "https://wordpress.stackexchange.com/users/115461",
"pm_score": 3,
"selected": true,
"text": "<p>The WC single item template is located at:</p>\n\n<p><code>yoursite.com/wp-content/plugins/woocommerce/temp... | 2019/11/23 | [
"https://wordpress.stackexchange.com/questions/353165",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34320/"
] | Wordpress initial install. Version `5.3`
>
> index.php
>
>
>
```
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
test
</bo... | The WC single item template is located at:
`yoursite.com/wp-content/plugins/woocommerce/templates/single-product.php`
See this documentation:
<https://docs.woocommerce.com/document/template-structure/>
So, you would want to move any of those templates to your child theme under `/wp-content/themes/your-child-theme/w... |
353,219 | <p>I've made a loop that goes over all the gigs I've attended, some gigs have the same songs.</p>
<p>Here is the result of that array:
<a href="http://snippi.com/s/k80v7pe" rel="nofollow noreferrer">http://snippi.com/s/k80v7pe</a></p>
<p>Now I want to have an array of all the distinct song id's. So want to see all t... | [
{
"answer_id": 353223,
"author": "cjbj",
"author_id": 75495,
"author_profile": "https://wordpress.stackexchange.com/users/75495",
"pm_score": 1,
"selected": false,
"text": "<p>No, that's because you are treating an <a href=\"https://www.php.net/manual/en/language.types.array.php\" rel=\"... | 2019/11/24 | [
"https://wordpress.stackexchange.com/questions/353219",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/178703/"
] | I've made a loop that goes over all the gigs I've attended, some gigs have the same songs.
Here is the result of that array:
<http://snippi.com/s/k80v7pe>
Now I want to have an array of all the distinct song id's. So want to see all the songs that I've ever heard:
```
//get the songs field get_field('songs')
foreac... | No, that's because you are treating an [array](https://www.php.net/manual/en/language.types.array.php) as an [object](https://www.php.net/manual/en/language.types.object.php) and `PHP` doesn't convert those types automatically. To get an individual element from an object you use:
```
$my_object->Element1;
```
To get... |
353,229 | <p>I'm using Woocommerce in WordPress and noticed the variation price does not show on the product page, but does when I add the item to a cart. The variation prices are the same no matter what the size selection is. I read this is an issue with Woocommerce, but I'm wondering if anyone has found a way to get the price ... | [
{
"answer_id": 353223,
"author": "cjbj",
"author_id": 75495,
"author_profile": "https://wordpress.stackexchange.com/users/75495",
"pm_score": 1,
"selected": false,
"text": "<p>No, that's because you are treating an <a href=\"https://www.php.net/manual/en/language.types.array.php\" rel=\"... | 2019/11/24 | [
"https://wordpress.stackexchange.com/questions/353229",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/178856/"
] | I'm using Woocommerce in WordPress and noticed the variation price does not show on the product page, but does when I add the item to a cart. The variation prices are the same no matter what the size selection is. I read this is an issue with Woocommerce, but I'm wondering if anyone has found a way to get the price to ... | No, that's because you are treating an [array](https://www.php.net/manual/en/language.types.array.php) as an [object](https://www.php.net/manual/en/language.types.object.php) and `PHP` doesn't convert those types automatically. To get an individual element from an object you use:
```
$my_object->Element1;
```
To get... |
353,233 | <p>I have a mystery problem. I have successfully created a custom post type, with associated categories. BUT, when I list the posts, the QuickEdit section does not display the title, date or any information. It is blank and I don't know why. Can anyone see the problem?</p>
<pre><code>//////////////////////// setup ... | [
{
"answer_id": 353236,
"author": "jg314",
"author_id": 26202,
"author_profile": "https://wordpress.stackexchange.com/users/26202",
"pm_score": 3,
"selected": true,
"text": "<p>The issue looks to be associated with your <code>mmd_member_track_columns_head()</code> function. Instead of mod... | 2019/11/24 | [
"https://wordpress.stackexchange.com/questions/353233",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/119560/"
] | I have a mystery problem. I have successfully created a custom post type, with associated categories. BUT, when I list the posts, the QuickEdit section does not display the title, date or any information. It is blank and I don't know why. Can anyone see the problem?
```
//////////////////////// setup admin pages
add_a... | The issue looks to be associated with your `mmd_member_track_columns_head()` function. Instead of modifying the default columns, they are being completely overwritten, causing the Quick Edit functionality to stop working. In particular, the `title` key must be part of the array for it to work. Try something like this:
... |
353,244 | <p>I am trying to write an if condition with 3 statements but it keeps crashing the site. Here is my statement, can you please advise what the issue is.</p>
<pre><code><?php if (is_page ('20')){?>
print this
<?php elseif (is_page ('50')){?>
then print this
<?php } else { ?>
print this
<?php } ?>... | [
{
"answer_id": 353246,
"author": "Jacob Peattie",
"author_id": 39152,
"author_profile": "https://wordpress.stackexchange.com/users/39152",
"pm_score": 2,
"selected": false,
"text": "<p>You're missing <code>}</code> before <code>elseif</code>:</p>\n\n<pre><code><?php if (is_page ('20')... | 2019/11/25 | [
"https://wordpress.stackexchange.com/questions/353244",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/66373/"
] | I am trying to write an if condition with 3 statements but it keeps crashing the site. Here is my statement, can you please advise what the issue is.
```
<?php if (is_page ('20')){?>
print this
<?php elseif (is_page ('50')){?>
then print this
<?php } else { ?>
print this
<?php } ?>
``` | You're missing `}` before `elseif`:
```
<?php if (is_page ('20')){?>
print this
<?php } elseif (is_page ('50')){?>
then print this
<?php } else { ?>
print this
<?php } ?>
```
Remove the PHP tags and you'll see why:
```
if ( is_page( '20' ) ) {
elseif ( is_page( '50' ) ) {
} else {
}
``` |
353,314 | <p>I tried everything. I even removed all content in functions.php and created a whole new file with just this:</p>
<pre><code>function wpdocs_dequeue_script() {
if (is_singular()) {
wp_dequeue_script( 'gdrts-rating' );
}
}
add_action( 'wp_print_scripts', 'wpdocs_dequeue_script', 100 );
</code></pre>
<p>The id... | [
{
"answer_id": 353251,
"author": "admcfajn",
"author_id": 123674,
"author_profile": "https://wordpress.stackexchange.com/users/123674",
"pm_score": 0,
"selected": false,
"text": "<p>Add a pre_get_posts filter.</p>\n\n<p>It looks like the following:</p>\n\n<pre><code>function do_this_befo... | 2019/11/25 | [
"https://wordpress.stackexchange.com/questions/353314",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/62192/"
] | I tried everything. I even removed all content in functions.php and created a whole new file with just this:
```
function wpdocs_dequeue_script() {
if (is_singular()) {
wp_dequeue_script( 'gdrts-rating' );
}
}
add_action( 'wp_print_scripts', 'wpdocs_dequeue_script', 100 );
```
The idea is to remove some Javas... | In WordPress, `name` is a [reserved term](https://codex.wordpress.org/Reserved_Terms) (emphasis mine):
>
> There is a complete set of reserved keywords, or terms, in WordPress
> that **should not be used in certain circumstances** as they may conflict
> with core functionality. You should avoid using any of these t... |
353,317 | <p>I am trying to get all posts from category <code>products</code>. My template looks like this: <code>/products/PARENT_CATEGORY/CHILD_CATEGORY</code>. What I need is all the posts from every CHILD_CATEGORY.</p>
<p>I try to access it via <code>/posts?categories=28</code>, but it returns no posts, as the category with... | [
{
"answer_id": 353324,
"author": "Faye",
"author_id": 76600,
"author_profile": "https://wordpress.stackexchange.com/users/76600",
"pm_score": 1,
"selected": false,
"text": "<p>I don't think you can query your posts via a url like that.</p>\n\n<p>Ideally, you would have a template file <c... | 2019/11/25 | [
"https://wordpress.stackexchange.com/questions/353317",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/178908/"
] | I am trying to get all posts from category `products`. My template looks like this: `/products/PARENT_CATEGORY/CHILD_CATEGORY`. What I need is all the posts from every CHILD\_CATEGORY.
I try to access it via `/posts?categories=28`, but it returns no posts, as the category with ID of 28 doesn't have any posts itself. B... | I had the same use case than you — calling WP-API from React — and ran into the same issue.
Unfortunately WP-API does not support filtering by parent categories. In order to support it, you could extend the API's functionality, adding a new filter that will run a `tax_query` behind the scenes, similar to [Faye's answe... |
353,353 | <p>You see I have a Navigation bar items, in the parent item <code>Products & Services</code> with two sub menus.</p>
<p><a href="https://i.stack.imgur.com/j59wZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/j59wZ.png" alt="redire"></a></p>
<p>I have a requirement, when I click the menu item ... | [
{
"answer_id": 353324,
"author": "Faye",
"author_id": 76600,
"author_profile": "https://wordpress.stackexchange.com/users/76600",
"pm_score": 1,
"selected": false,
"text": "<p>I don't think you can query your posts via a url like that.</p>\n\n<p>Ideally, you would have a template file <c... | 2019/11/26 | [
"https://wordpress.stackexchange.com/questions/353353",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/178244/"
] | You see I have a Navigation bar items, in the parent item `Products & Services` with two sub menus.
[](https://i.stack.imgur.com/j59wZ.png)
I have a requirement, when I click the menu item `Products & Services` it redirect to its sub-menu `Dedicated Servers`.
How can I ... | I had the same use case than you — calling WP-API from React — and ran into the same issue.
Unfortunately WP-API does not support filtering by parent categories. In order to support it, you could extend the API's functionality, adding a new filter that will run a `tax_query` behind the scenes, similar to [Faye's answe... |
353,370 | <p>Is it possible to block specific plugins from updating, manually too? I don't want to block this by hiding the notification, changing the plugin version or anything like this. I'd like the notification to show, show the new version number, but when hitting the update manually it should block/disallow this - preferab... | [
{
"answer_id": 353324,
"author": "Faye",
"author_id": 76600,
"author_profile": "https://wordpress.stackexchange.com/users/76600",
"pm_score": 1,
"selected": false,
"text": "<p>I don't think you can query your posts via a url like that.</p>\n\n<p>Ideally, you would have a template file <c... | 2019/11/26 | [
"https://wordpress.stackexchange.com/questions/353370",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/142331/"
] | Is it possible to block specific plugins from updating, manually too? I don't want to block this by hiding the notification, changing the plugin version or anything like this. I'd like the notification to show, show the new version number, but when hitting the update manually it should block/disallow this - preferably ... | I had the same use case than you — calling WP-API from React — and ran into the same issue.
Unfortunately WP-API does not support filtering by parent categories. In order to support it, you could extend the API's functionality, adding a new filter that will run a `tax_query` behind the scenes, similar to [Faye's answe... |
353,379 | <p>I have a created a contact form in the <code>function.php</code> and added short code on my page and it's working. I am getting my form.</p>
<pre><code>function st_contact_form(){
ob_start();
?>
<div class="contact_form-wrapper popup-contact-form">
<form action="" method="post" name="... | [
{
"answer_id": 353392,
"author": "Manan",
"author_id": 178960,
"author_profile": "https://wordpress.stackexchange.com/users/178960",
"pm_score": -1,
"selected": false,
"text": "<p>Yes you have to write code for inserting data in your process.php</p>\n\n<pre><code>global $wpdb;\n$name=$_P... | 2019/11/26 | [
"https://wordpress.stackexchange.com/questions/353379",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/177715/"
] | I have a created a contact form in the `function.php` and added short code on my page and it's working. I am getting my form.
```
function st_contact_form(){
ob_start();
?>
<div class="contact_form-wrapper popup-contact-form">
<form action="" method="post" name="contact_form" id="contact_form" autoc... | Finally, I got my solution,
I added below code in `function.php` and using shortcode I am getting my form on webpage
```
function st_contact_form(){
ob_start();
?>
<div class="contact_form-wrapper popup-contact-form">
<form action="" method="post" name="contact_form" id="contact_form" autocomplete=... |
353,389 | <p>When i attach below line code i get white screen and in console log it is getting below error my browsers are up to date</p>
<p>Code </p>
<pre><code>body:not(.no-transition) #wrapper, .animsition-overlay { position: relative; opacity: 0; -webkit-animation-fill-mode: both;
animation-fill-mode: both; }
</... | [
{
"answer_id": 353397,
"author": "Andrew",
"author_id": 164495,
"author_profile": "https://wordpress.stackexchange.com/users/164495",
"pm_score": 1,
"selected": false,
"text": "<p>\"White screen\" generally means there is a PHP error preventing the page from being generated. You should <... | 2019/11/26 | [
"https://wordpress.stackexchange.com/questions/353389",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/178938/"
] | When i attach below line code i get white screen and in console log it is getting below error my browsers are up to date
Code
```
body:not(.no-transition) #wrapper, .animsition-overlay { position: relative; opacity: 0; -webkit-animation-fill-mode: both;
animation-fill-mode: both; }
```
Console log error... | "White screen" generally means there is a PHP error preventing the page from being generated. You should [check your WordPress error log](https://wordpress.org/support/article/debugging-in-wordpress/) (wp-content/debug.log by default) for any relevant errors.
Adding CSS code would not prevent the page from loading. |
353,426 | <p>I have the following situation which I tried to solve by using the website and forum but unfortunately no success so far.</p>
<p>I am working on a new site (old still-now online) but when changing the Site Address (URL), i receive a error 404 when trying to accees the site www.gas-spring.com. <a href="https://i.sta... | [
{
"answer_id": 353430,
"author": "Vimal Usadadiya",
"author_id": 178951,
"author_profile": "https://wordpress.stackexchange.com/users/178951",
"pm_score": 1,
"selected": false,
"text": "<p>You can also change site address in database direct. You can use below link to generate sql query t... | 2019/11/27 | [
"https://wordpress.stackexchange.com/questions/353426",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/178986/"
] | I have the following situation which I tried to solve by using the website and forum but unfortunately no success so far.
I am working on a new site (old still-now online) but when changing the Site Address (URL), i receive a error 404 when trying to accees the site www.gas-spring.com. [![enter image description here]... | You have installed your website in public\_html/wordpress so you need to move it up a directory in FTP or change your URL in the dashboard to gas-springs.com/wordpress.
The JSON error is because your Wordpress URL is HTTP and the Site URL is HTTPS. |
353,441 | <p>Is there a simple method to passing data from one file to another? I'm new to PHP and can't find a simple answer to my problem online. Apologies if this has been answered a million times & thanks in advance. </p>
<pre><code>My Template
<?php
// Declare a variable with the name of the file I want to pull ... | [
{
"answer_id": 353442,
"author": "Antti Koskinen",
"author_id": 144392,
"author_profile": "https://wordpress.stackexchange.com/users/144392",
"pm_score": 3,
"selected": true,
"text": "<p>The WordPress template functions don't support passing variables (to my knowledge) by default, so you... | 2019/11/27 | [
"https://wordpress.stackexchange.com/questions/353441",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/163457/"
] | Is there a simple method to passing data from one file to another? I'm new to PHP and can't find a simple answer to my problem online. Apologies if this has been answered a million times & thanks in advance.
```
My Template
<?php
// Declare a variable with the name of the file I want to pull in
$critical_css = 's... | The WordPress template functions don't support passing variables (to my knowledge) by default, so you need to write your own function. For example like this,
```
// functions.php
function my_template_include_with_variables( string $path = '', $data = null ) {
$file = get_template_directory() . '/' . $path . '.php';
... |
353,454 | <p>I have an old server that runs important PHP aplication that required PHP 5.2.17. What is the newest WordPress that I can install on it?</p>
| [
{
"answer_id": 353442,
"author": "Antti Koskinen",
"author_id": 144392,
"author_profile": "https://wordpress.stackexchange.com/users/144392",
"pm_score": 3,
"selected": true,
"text": "<p>The WordPress template functions don't support passing variables (to my knowledge) by default, so you... | 2019/11/27 | [
"https://wordpress.stackexchange.com/questions/353454",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/105257/"
] | I have an old server that runs important PHP aplication that required PHP 5.2.17. What is the newest WordPress that I can install on it? | The WordPress template functions don't support passing variables (to my knowledge) by default, so you need to write your own function. For example like this,
```
// functions.php
function my_template_include_with_variables( string $path = '', $data = null ) {
$file = get_template_directory() . '/' . $path . '.php';
... |
353,488 | <p>I have set up a custom post type (CPT) with the support for editor removed:</p>
<pre><code>register_post_type( 'review', array(
'label' => 'Reviews',
'labels' => array(
'name' => 'Reviews',
/* etc */
),
'description' => 'Tour reviews',
'menu_icon' => 'dashicons-form... | [
{
"answer_id": 353490,
"author": "Vitor Almeida",
"author_id": 92290,
"author_profile": "https://wordpress.stackexchange.com/users/92290",
"pm_score": 1,
"selected": false,
"text": "<p>When registering or updating any rewrite for any post/custom post type you need to flush rewrite rules ... | 2019/11/27 | [
"https://wordpress.stackexchange.com/questions/353488",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/88982/"
] | I have set up a custom post type (CPT) with the support for editor removed:
```
register_post_type( 'review', array(
'label' => 'Reviews',
'labels' => array(
'name' => 'Reviews',
/* etc */
),
'description' => 'Tour reviews',
'menu_icon' => 'dashicons-format-chat',
'public' => tr... | Update
======
As Vitor Almeida suggested, I tried this in a blank installation of WP (v5.3) with only the default plugins installed and my theme. In this setting all works fine, as it should. Seems like one of the plugins below messes the slug up by providing the slug `input` field with a default (wrong) value when cr... |
353,659 | <p>I want to change the article url as</p>
<pre><code>www.***.com/post/%post_id%
</code></pre>
<p>For example,</p>
<pre><code>www.***.com/post/156/
</code></pre>
<p>And now, I did it.</p>
<p>But I don't know how to change the category like this. For example,</p>
<pre><code>www.***.com/category/12/
</code></pre>
... | [
{
"answer_id": 353672,
"author": "Spcaeyob",
"author_id": 164672,
"author_profile": "https://wordpress.stackexchange.com/users/164672",
"pm_score": -1,
"selected": false,
"text": "<p>Go to Admin panel -> Settings -> Permalinks. Change your permalink structure to numerical. Also change yo... | 2019/11/30 | [
"https://wordpress.stackexchange.com/questions/353659",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/179137/"
] | I want to change the article url as
```
www.***.com/post/%post_id%
```
For example,
```
www.***.com/post/156/
```
And now, I did it.
But I don't know how to change the category like this. For example,
```
www.***.com/category/12/
```
Generally, the category url is:
```
www.***.com/category/cat1/cat1.1/cat1.1... | I find my answer on the internet.
```
function numeric_category_rewrite_rules( $rules ) {
$custom_rules = array();
foreach ( $rules as $regex => $rewrite ) {
$regex = str_replace( '/(.+?)/', '/([0-9]{1,})/', $regex );
$rewrite = str_replace( '?category_name=', '?cat=', $rewrite );
$cust... |
353,734 | <p>I really can't get the right practices from official docs. I think it's a complete mess.</p>
<p>At some point, they started to say to activate the title-tag feature: after_setup_theme ></p>
<pre><code>add_theme_support('title-tag');
</code></pre>
<ul>
<li><p>Ok. At this point they stated we should delete the <cod... | [
{
"answer_id": 353735,
"author": "Luca Reghellin",
"author_id": 10381,
"author_profile": "https://wordpress.stackexchange.com/users/10381",
"pm_score": -1,
"selected": false,
"text": "<p>As far as I can say, currently for me the best option is the old school <code>wp_title()</code> thing... | 2019/12/02 | [
"https://wordpress.stackexchange.com/questions/353734",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/10381/"
] | I really can't get the right practices from official docs. I think it's a complete mess.
At some point, they started to say to activate the title-tag feature: after\_setup\_theme >
```
add_theme_support('title-tag');
```
* Ok. At this point they stated we should delete the `<title>` tag from page and stop using `wp... | Do you have any SEO plugins installed? They usually fiddle with this logic. Having Yoast enabled, the `pre_get_document_title` does not work for me, instead you should use `wpseo_title` [per their documentation](https://yoast.com/wordpress/plugins/seo/api/).
Having said that, with SEO plugins disabled and `add_theme_s... |
353,742 | <p>While working with <code>ServerSideRender</code> wordpress gutenberg component, I am seeing the following notice.</p>
<p><code>wp.components.ServerSideRender is deprecated. Please use wp.serverSideRender instead.</code></p>
<p>Here is my test code:</p>
<pre><code>const { __ } = wp.i18n;
const { registerBlockType ... | [
{
"answer_id": 353778,
"author": "WebElaine",
"author_id": 102815,
"author_profile": "https://wordpress.stackexchange.com/users/102815",
"pm_score": 2,
"selected": false,
"text": "<p>This just means they moved the component. Replace this part:</p>\n\n<pre><code>const {\n PanelBody, Se... | 2019/12/02 | [
"https://wordpress.stackexchange.com/questions/353742",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/130217/"
] | While working with `ServerSideRender` wordpress gutenberg component, I am seeing the following notice.
`wp.components.ServerSideRender is deprecated. Please use wp.serverSideRender instead.`
Here is my test code:
```
const { __ } = wp.i18n;
const { registerBlockType } = wp.blocks;
const { Fragment } = wp.element;
c... | The component is still functional, the issue is due to how it was pulled out into its own package. It is no longer uppercase and in order to use it in JSX, you will need to alias it:
`const { serverSideRender: ServerSideRender } = wp;`
See [this issue](https://github.com/WordPress/gutenberg/pull/18722) for more detai... |
353,764 | <p>I need to have the client's theme colors here so he doesn't have to remember the color codes each time he's using them. </p>
<p><a href="https://i.stack.imgur.com/gJ0PN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gJ0PN.png" alt="enter image description here"></a>
Is </p>
<p>is there any way ... | [
{
"answer_id": 353769,
"author": "WebElaine",
"author_id": 102815,
"author_profile": "https://wordpress.stackexchange.com/users/102815",
"pm_score": 2,
"selected": true,
"text": "<p>Rather than adjusting the default palette, you can define (and enforce) a custom palette.</p>\n\n<pre><cod... | 2019/12/02 | [
"https://wordpress.stackexchange.com/questions/353764",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/115614/"
] | I need to have the client's theme colors here so he doesn't have to remember the color codes each time he's using them.
[](https://i.stack.imgur.com/gJ0PN.png)
Is
is there any way to Add/Remove/Change some colors from the default "Paragraph" block ... | Rather than adjusting the default palette, you can define (and enforce) a custom palette.
```
<?php
// Add a custom palette
add_action( 'after_setup_theme', 'wpse_block_color_palette' );
function wpse_block_color_palette() {
add_theme_support(
// Define the colors
'editor-color-palette', array(
... |
353,776 | <p>I want to disable rss feed,my wordpress version is <strong>5.2.4</strong>.</p>
<p>see my code below to disable rss feed.</p>
<pre><code> function itsme_disable_feed() {
wp_die( __( 'No feed available' ) );
}
add_action('do_feed', 'itsme_disable_feed', 1);
add_action('do_feed_rdf', 'itsme_disable_feed', 1);
add_a... | [
{
"answer_id": 353789,
"author": "Eoin H",
"author_id": 86679,
"author_profile": "https://wordpress.stackexchange.com/users/86679",
"pm_score": 1,
"selected": false,
"text": "<p>have you tried using remove_action?</p>\n\n<p>Example:</p>\n\n<pre><code><?php\nadd_action('wp_head', 'remo... | 2019/12/02 | [
"https://wordpress.stackexchange.com/questions/353776",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/157283/"
] | I want to disable rss feed,my wordpress version is **5.2.4**.
see my code below to disable rss feed.
```
function itsme_disable_feed() {
wp_die( __( 'No feed available' ) );
}
add_action('do_feed', 'itsme_disable_feed', 1);
add_action('do_feed_rdf', 'itsme_disable_feed', 1);
add_action('do_feed_rss', 'itsme_disabl... | You need to define the HTTP Response code in `wp_die` function.
```php
wp_die( __('No feed available'), '', 404 );
```
Also set custom header to get HTML page instead of xml page. So the code should be like below.
```php
function itsme_disable_feed() {
global $wp_query;
$wp_query->is_feed = false;
$wp_query->set... |
353,785 | <p>WordPress is amazing and I am a very big fan of it.</p>
<p>But the version 5.3 brought me (an many others, <a href="https://wordpress.org/support/topic/unable-to-upload-images-67/" rel="nofollow noreferrer">1</a>, <a href="https://wordpress.org/support/topic/cant-upload-to-media-library-4/" rel="nofollow noreferrer... | [
{
"answer_id": 353815,
"author": "user3135691",
"author_id": 59755,
"author_profile": "https://wordpress.stackexchange.com/users/59755",
"pm_score": -1,
"selected": false,
"text": "<p>You need to remove the quotes around '__return_false'.</p>\n\n<pre><code><?php\n// Remove the quotes ... | 2019/12/02 | [
"https://wordpress.stackexchange.com/questions/353785",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/155394/"
] | WordPress is amazing and I am a very big fan of it.
But the version 5.3 brought me (an many others, [1](https://wordpress.org/support/topic/unable-to-upload-images-67/), [2](https://wordpress.org/support/topic/cant-upload-to-media-library-4/), [3](https://stackoverflow.com/questions/58849039/wordpress-image-upload-tim... | Now it is working as expected *(disabled scaling)*, under the following settings:
In my theme **functions.php**
```
add_filter( 'big_image_size_threshold', '__return_false' );
```
In the **WP Media Settings**:
[](https://i.stack.imgur.com/CgKQr.pn... |
353,845 | <p>I don't know why, but now, Wordpress is adding a suffix "-scaled" at the end of each newly uploaded image.</p>
<p><a href="https://i.stack.imgur.com/Di2gL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Di2gL.png" alt="enter image description here"></a></p>
<p>And, instead of keeping the origina... | [
{
"answer_id": 354318,
"author": "Ivan Ivan",
"author_id": 179574,
"author_profile": "https://wordpress.stackexchange.com/users/179574",
"pm_score": 1,
"selected": false,
"text": "<p>This plugin helped me: <a href=\"https://wordpress.org/plugins/wp-smushit/\" rel=\"nofollow noreferrer\">... | 2019/12/03 | [
"https://wordpress.stackexchange.com/questions/353845",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/143330/"
] | I don't know why, but now, Wordpress is adding a suffix "-scaled" at the end of each newly uploaded image.
[](https://i.stack.imgur.com/Di2gL.png)
And, instead of keeping the original image link, it changes it to the "-scaled" version:
[![enter imag... | ### How to disable this behaviour?
Add this to your `functions.php`:
```php
add_filter( 'big_image_size_threshold', '__return_false' );
```
### How does it work?
When a new image is uploaded, WordPress will detect if it is a “big” image by checking if its height or width exceeds the big\_image threshold. The defau... |
353,865 | <p>The <code>wp_mail()</code> function is not running when scheduled in a cron function. I have added the following function: </p>
<pre><code>add_filter( 'cron_schedules', 'isa_add_every_one_minutes' );
function isa_add_every_one_minutes( $schedules ) {
$schedules['every_sixty_seconds'] = array(
'inter... | [
{
"answer_id": 353906,
"author": "butlerblog",
"author_id": 38603,
"author_profile": "https://wordpress.stackexchange.com/users/38603",
"pm_score": 2,
"selected": false,
"text": "<p>This one is a bit of a puzzler. I was originally going to say you need to determine if there's something w... | 2019/12/03 | [
"https://wordpress.stackexchange.com/questions/353865",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/142821/"
] | The `wp_mail()` function is not running when scheduled in a cron function. I have added the following function:
```
add_filter( 'cron_schedules', 'isa_add_every_one_minutes' );
function isa_add_every_one_minutes( $schedules ) {
$schedules['every_sixty_seconds'] = array(
'interval' => 60,
... | This one is a bit of a puzzler. I was originally going to say you need to determine if there's something wrong *after* the mail is sent since you're getting the hit in the next operation. But then I re-read it and caught the part about the email being received when it's run manually.
What you need to do is find out if... |
353,867 | <p>I want to create a custom category page, only for the first page, displaying an article, related posts, latest posts. How can I do that? </p>
| [
{
"answer_id": 353871,
"author": "Steffen Görg",
"author_id": 131265,
"author_profile": "https://wordpress.stackexchange.com/users/131265",
"pm_score": 2,
"selected": false,
"text": "<p>I don´t think you can do this within the template overwrite structure of wordpress but you can include... | 2019/12/03 | [
"https://wordpress.stackexchange.com/questions/353867",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/176650/"
] | I want to create a custom category page, only for the first page, displaying an article, related posts, latest posts. How can I do that? | I don´t think you can do this within the template overwrite structure of wordpress but you can include a custom template based on the pagination number.
```
if(get_query_var('paged') == 0){
echo "Include your custom theme here";
}else{
echo "standard";
}
``` |
353,869 | <p>I want to put this:</p>
<pre><code>[products ids="17,32,12,1,57"]
</code></pre>
<p>And I want them to display in EXACTLY this order. </p>
<p>Is this possible?</p>
| [
{
"answer_id": 353870,
"author": "Steffen Görg",
"author_id": 131265,
"author_profile": "https://wordpress.stackexchange.com/users/131265",
"pm_score": -1,
"selected": false,
"text": "<p>Have you tried to use the \norderby=\"menu_order\"\nparameter in the shortcode? You can set the menu ... | 2019/12/03 | [
"https://wordpress.stackexchange.com/questions/353869",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/14825/"
] | I want to put this:
```
[products ids="17,32,12,1,57"]
```
And I want them to display in EXACTLY this order.
Is this possible? | You can use `woocommerce_shortcode_products_query` filter to change `orderby` argument. it will set `orderby` as `post__in` in `[products]` shortcode query. I have tested and it is working fine for me. you can take reference from below code and adjust code as per your need. Let me know if this works for you!
```
add_f... |
353,929 | <p>Is there a function that would return the equivalent of <code>plugin_dir_path</code> but it being agnostic of a plugin / theme? JS scripts need to be enqueued as resources, as such, you cannot include their on-server path which is, say <code>/var/www/html/wordpress/thing/thing2/script.js</code>, it needs to be the <... | [
{
"answer_id": 353932,
"author": "butlerblog",
"author_id": 38603,
"author_profile": "https://wordpress.stackexchange.com/users/38603",
"pm_score": 1,
"selected": false,
"text": "<p>This is kind of a hacky way to do this; but unfortunately, there is not a WP function that will do both (t... | 2019/12/04 | [
"https://wordpress.stackexchange.com/questions/353929",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/177618/"
] | Is there a function that would return the equivalent of `plugin_dir_path` but it being agnostic of a plugin / theme? JS scripts need to be enqueued as resources, as such, you cannot include their on-server path which is, say `/var/www/html/wordpress/thing/thing2/script.js`, it needs to be the `http://www.example.com/th... | Although @butlerblog's answer works, I find it unecessarily complex. I've checked above and beyond, `site_url` will always give you the current site's link, it will resolve the schemas for you, whether or not it's `http` or `https`, etc and as such, there's no issues with it.
I've written a simpler, easier to understa... |
353,995 | <p>I have a custom post type called 'event'. An event has multiple subpages like registration, speakers, contact us, etc. Currently the content is saved as one or more custom fields. </p>
<p>I would like to have an url structure like</p>
<ul>
<li><code>events/{event_slug}/registration</code> </li>
<li><code>events/{e... | [
{
"answer_id": 353932,
"author": "butlerblog",
"author_id": 38603,
"author_profile": "https://wordpress.stackexchange.com/users/38603",
"pm_score": 1,
"selected": false,
"text": "<p>This is kind of a hacky way to do this; but unfortunately, there is not a WP function that will do both (t... | 2019/12/05 | [
"https://wordpress.stackexchange.com/questions/353995",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/111408/"
] | I have a custom post type called 'event'. An event has multiple subpages like registration, speakers, contact us, etc. Currently the content is saved as one or more custom fields.
I would like to have an url structure like
* `events/{event_slug}/registration`
* `events/{event_slug}/speakers`
* `events/{event_slug}/c... | Although @butlerblog's answer works, I find it unecessarily complex. I've checked above and beyond, `site_url` will always give you the current site's link, it will resolve the schemas for you, whether or not it's `http` or `https`, etc and as such, there's no issues with it.
I've written a simpler, easier to understa... |
354,085 | <p>I need to do something like that:</p>
<pre><code> $postsOrder = get_sub_field('posts-ordering');
if ($postsOrder = 'post_views_count') {
$queryPopular = array (
'meta_key' => 'post_views_count',
'orderby' => 'meta_value_num',
);
}... | [
{
"answer_id": 354084,
"author": "Tom J Nowell",
"author_id": 736,
"author_profile": "https://wordpress.stackexchange.com/users/736",
"pm_score": 3,
"selected": true,
"text": "<blockquote>\n <p>I've been looking in the DB to see where WP stores the modified dates for taxonomies but I've... | 2019/12/07 | [
"https://wordpress.stackexchange.com/questions/354085",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/116847/"
] | I need to do something like that:
```
$postsOrder = get_sub_field('posts-ordering');
if ($postsOrder = 'post_views_count') {
$queryPopular = array (
'meta_key' => 'post_views_count',
'orderby' => 'meta_value_num',
);
}
$query = n... | >
> I've been looking in the DB to see where WP stores the modified dates for taxonomies but I've been unable to find the right table.
>
>
>
It doesn't. There is no last modified date for terms, that data simply doesn't exist in the tables in vanilla WP. If you want it, you're going to have to track and store it ... |
354,137 | <p>I'm trying to develop a simple plugin but I'm having a problem: I have a custom <code>WP_List_Table</code> in an admin page, but when I click on a button like "Edit Row" or "Delete Row" it performs some expected action and try to refresh the page using <code>wp_redirect()</code>. This is causing a problem:</p>
<pre... | [
{
"answer_id": 354169,
"author": "butlerblog",
"author_id": 38603,
"author_profile": "https://wordpress.stackexchange.com/users/38603",
"pm_score": 1,
"selected": false,
"text": "<p>I'm not 100% certain <em>this</em> is your problem, <em>but</em>... I believe your \"no_items\" function s... | 2019/12/07 | [
"https://wordpress.stackexchange.com/questions/354137",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/179378/"
] | I'm trying to develop a simple plugin but I'm having a problem: I have a custom `WP_List_Table` in an admin page, but when I click on a button like "Edit Row" or "Delete Row" it performs some expected action and try to refresh the page using `wp_redirect()`. This is causing a problem:
```
Warning: Cannot modify header... | This code uses another method to show a "sucess" or "deleted" message without using wp\_redirect: <https://github.com/pmbaldha/WP-Custom-List-Table-With-Database-Example> |
354,143 | <p>hi i am looking to combing to pieces of code into 1 both work but not together keep no matter what i try it keeps crashing the site </p>
<pre><code><?php
$t=date("H");
if ($t<"12")
{
echo " Have a good morning! $display_name ";
}
else if ($t<"18")
{
echo " Have a good afternoon! $displa... | [
{
"answer_id": 354169,
"author": "butlerblog",
"author_id": 38603,
"author_profile": "https://wordpress.stackexchange.com/users/38603",
"pm_score": 1,
"selected": false,
"text": "<p>I'm not 100% certain <em>this</em> is your problem, <em>but</em>... I believe your \"no_items\" function s... | 2019/12/07 | [
"https://wordpress.stackexchange.com/questions/354143",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/69081/"
] | hi i am looking to combing to pieces of code into 1 both work but not together keep no matter what i try it keeps crashing the site
```
<?php
$t=date("H");
if ($t<"12")
{
echo " Have a good morning! $display_name ";
}
else if ($t<"18")
{
echo " Have a good afternoon! $display_name ";
}
else
{
... | This code uses another method to show a "sucess" or "deleted" message without using wp\_redirect: <https://github.com/pmbaldha/WP-Custom-List-Table-With-Database-Example> |
354,179 | <p>It's been asked a gazillion times but it's still not working in my Wordpress. I want to redirect everything to <a href="https://website.com" rel="nofollow noreferrer">https://website.com</a>.
Current code been used:</p>
<pre><code><IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} of... | [
{
"answer_id": 354182,
"author": "Elgoots",
"author_id": 179379,
"author_profile": "https://wordpress.stackexchange.com/users/179379",
"pm_score": 0,
"selected": false,
"text": "<p>Setting the wordpress home and site url manually to <a href=\"https://website.com\" rel=\"nofollow noreferr... | 2019/12/08 | [
"https://wordpress.stackexchange.com/questions/354179",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/179485/"
] | It's been asked a gazillion times but it's still not working in my Wordpress. I want to redirect everything to <https://website.com>.
Current code been used:
```
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.... | This is what you want:
```
RewriteEngine On
RewriteCond %{HTTP_HOST} website\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://website.com/$1 [R,L]
```
@elgoots, the reason yours was close but still had trouble is your HTTP\_HOST has the www in it. |
354,184 | <p>I want to add a button on my wordpress page. When the user click on it, the text box above that button show a random number between 1-10000</p>
<p>I am quite new to Wordpress, I want to integrate some scripts to my Wordpress site to do this random number generation. For example I can call a php function when clicki... | [
{
"answer_id": 354192,
"author": "Ali Qorbani",
"author_id": 73590,
"author_profile": "https://wordpress.stackexchange.com/users/73590",
"pm_score": 1,
"selected": false,
"text": "<p>all thing you have to do is use javaScript function</p>\n\n<p><strong>JavaScript Example:</strong></p>\n\... | 2019/12/09 | [
"https://wordpress.stackexchange.com/questions/354184",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/179493/"
] | I want to add a button on my wordpress page. When the user click on it, the text box above that button show a random number between 1-10000
I am quite new to Wordpress, I want to integrate some scripts to my Wordpress site to do this random number generation. For example I can call a php function when clicking that bu... | all thing you have to do is use javaScript function
**JavaScript Example:**
```
var random_number = function(){
return Math.floor(Math.random() * 10000) + 1;
};
document.getElementById('button_text').onclick = function () {
document.getElementById("input_box").innerHTML = random_number();
};
```
**jQuery Ex... |
354,207 | <p>I use "Digits (WordPress Mobile Number Signup and Login)" for signup by email & SMS ;
when non logged in user proceed to checkout , want to redirect to signup form of Digits (not usual woocommerce signup).</p>
<p>In case already logged-in users, they should go following the next step in the checkout process as ... | [
{
"answer_id": 354192,
"author": "Ali Qorbani",
"author_id": 73590,
"author_profile": "https://wordpress.stackexchange.com/users/73590",
"pm_score": 1,
"selected": false,
"text": "<p>all thing you have to do is use javaScript function</p>\n\n<p><strong>JavaScript Example:</strong></p>\n\... | 2019/12/09 | [
"https://wordpress.stackexchange.com/questions/354207",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/179503/"
] | I use "Digits (WordPress Mobile Number Signup and Login)" for signup by email & SMS ;
when non logged in user proceed to checkout , want to redirect to signup form of Digits (not usual woocommerce signup).
In case already logged-in users, they should go following the next step in the checkout process as normal.
appre... | all thing you have to do is use javaScript function
**JavaScript Example:**
```
var random_number = function(){
return Math.floor(Math.random() * 10000) + 1;
};
document.getElementById('button_text').onclick = function () {
document.getElementById("input_box").innerHTML = random_number();
};
```
**jQuery Ex... |
354,281 | <p>I'm trying to add a button (its function is beyond the scope of this question, suffice it to say that it needs the refund id as an argument) to each refund line in a WooCommerce order. I found that those lines are created in woocommerce\includes\admin\meta-boxes\views\html-order-refund.php which can't be overridden.... | [
{
"answer_id": 354282,
"author": "butlerblog",
"author_id": 38603,
"author_profile": "https://wordpress.stackexchange.com/users/38603",
"pm_score": 3,
"selected": true,
"text": "<p>Two inherent problems with your script as posted. I'm not certain this will solve your problem, but it's to... | 2019/12/10 | [
"https://wordpress.stackexchange.com/questions/354281",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/97921/"
] | I'm trying to add a button (its function is beyond the scope of this question, suffice it to say that it needs the refund id as an argument) to each refund line in a WooCommerce order. I found that those lines are created in woocommerce\includes\admin\meta-boxes\views\html-order-refund.php which can't be overridden. Ho... | Two inherent problems with your script as posted. I'm not certain this will solve your problem, but it's too big to address in the comments.
First, you need to use `add_action()`, *not* `add_filter()`. That by itself is not a *huge* deal because `add_action()` is just a wrapper for `add_filter()`, but you should still... |
354,353 | <p>I am having a filter for the content that adds a Table of Contents at the top of my posts. I took the basic idea from an answer at Stack Exchange itself.</p>
<p>I add the filter as follows:</p>
<pre><code>add_filter('the_content', array('TableOfContents', 'writeTOC'), 100);
</code></pre>
<p>And until here it is f... | [
{
"answer_id": 354354,
"author": "butlerblog",
"author_id": 38603,
"author_profile": "https://wordpress.stackexchange.com/users/38603",
"pm_score": 0,
"selected": false,
"text": "<p>There might be a better way to do this, but without knowing the full extent of the process (other than the... | 2019/12/11 | [
"https://wordpress.stackexchange.com/questions/354353",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/166927/"
] | I am having a filter for the content that adds a Table of Contents at the top of my posts. I took the basic idea from an answer at Stack Exchange itself.
I add the filter as follows:
```
add_filter('the_content', array('TableOfContents', 'writeTOC'), 100);
```
And until here it is fine, but the problem comes in ano... | You can temporarily detach the function from the hook.
```
// THIS IS MY PROBLEM LINE, i USE Apply Filters for post content....
$priority = has_filter('the_content', ['TableOfContents', 'writeTOC'] );
if ( $priority !== false )
remove_filter('the_content', ['TableOfContents', 'writeTOC'], $priorit... |
354,357 | <p>In my plugin, I have a custom post type with a specific behaviour. </p>
<p>The administrator after to publish it, he should not be able to set the post as draft again.</p>
<p>How can I do this ?</p>
| [
{
"answer_id": 354354,
"author": "butlerblog",
"author_id": 38603,
"author_profile": "https://wordpress.stackexchange.com/users/38603",
"pm_score": 0,
"selected": false,
"text": "<p>There might be a better way to do this, but without knowing the full extent of the process (other than the... | 2019/12/11 | [
"https://wordpress.stackexchange.com/questions/354357",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/128094/"
] | In my plugin, I have a custom post type with a specific behaviour.
The administrator after to publish it, he should not be able to set the post as draft again.
How can I do this ? | You can temporarily detach the function from the hook.
```
// THIS IS MY PROBLEM LINE, i USE Apply Filters for post content....
$priority = has_filter('the_content', ['TableOfContents', 'writeTOC'] );
if ( $priority !== false )
remove_filter('the_content', ['TableOfContents', 'writeTOC'], $priorit... |
354,370 | <p>I'm using the following function to add a custom field called "price_1_50" to each product variation:</p>
<pre><code>add_action( 'woocommerce_variation_options_pricing', 'bbloomer_add_custom_field_to_variations', 10, 3 );
function bbloomer_add_custom_field_to_variations( $loop, $variation_data, $variation ) {
wooco... | [
{
"answer_id": 354377,
"author": "TomC",
"author_id": 36980,
"author_profile": "https://wordpress.stackexchange.com/users/36980",
"pm_score": 0,
"selected": false,
"text": "<p>Try using the following:</p>\n\n<pre><code>$post = $wp_query->post;\nglobal $post; \n</code></pre>\n\n<p>Then... | 2019/12/11 | [
"https://wordpress.stackexchange.com/questions/354370",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/107745/"
] | I'm using the following function to add a custom field called "price\_1\_50" to each product variation:
```
add_action( 'woocommerce_variation_options_pricing', 'bbloomer_add_custom_field_to_variations', 10, 3 );
function bbloomer_add_custom_field_to_variations( $loop, $variation_data, $variation ) {
woocommerce_wp_te... | Ok, I've managed to solve this. This is how i finally created variations custom field:
```
add_action( 'woocommerce_product_after_variable_attributes', 'variation_settings_fields', 10, 3 );
add_action( 'woocommerce_save_product_variation', 'save_variation_settings_fields', 10, 2 );
function variation_settings_fields... |
354,378 | <p>I'm building a theme in _S and using native Gutenberg blocks.</p>
<p>I have the following code via my functions.php file to set my image sizes:</p>
<pre><code>add_theme_support( 'post-thumbnails' );
add_image_size( 'carousel', 1366, 550, true );
add_image_size( 'hero', 1366, 400, true );
add_image_size( 'large-squ... | [
{
"answer_id": 354379,
"author": "Sam",
"author_id": 37548,
"author_profile": "https://wordpress.stackexchange.com/users/37548",
"pm_score": 5,
"selected": true,
"text": "<p>I found the culprit! </p>\n\n<p>WordPress 5.3 introduced additional image sizes which can be found via <code>/wp-i... | 2019/12/11 | [
"https://wordpress.stackexchange.com/questions/354378",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/37548/"
] | I'm building a theme in \_S and using native Gutenberg blocks.
I have the following code via my functions.php file to set my image sizes:
```
add_theme_support( 'post-thumbnails' );
add_image_size( 'carousel', 1366, 550, true );
add_image_size( 'hero', 1366, 400, true );
add_image_size( 'large-square', 392, 340, true... | I found the culprit!
WordPress 5.3 introduced additional image sizes which can be found via `/wp-includes/media.php`.
Updating my function, like so, removed the extra sizes:
```
function remove_default_image_sizes( $sizes) {
unset( $sizes['large']); // Added to remove 1024
unset( $sizes['thumbnail']);
u... |
354,396 | <p>I need to get some random posts and order them by date.</p>
<p>To get random posts I used the following:</p>
<pre><code>$query = new WP_Query(
[
'post__in' => $post_id_array,
'posts_per_page' => $number,
'orderby' => 'rand'
]
);
</code></pre>
<p>To order by date I tried this:<... | [
{
"answer_id": 354379,
"author": "Sam",
"author_id": 37548,
"author_profile": "https://wordpress.stackexchange.com/users/37548",
"pm_score": 5,
"selected": true,
"text": "<p>I found the culprit! </p>\n\n<p>WordPress 5.3 introduced additional image sizes which can be found via <code>/wp-i... | 2019/12/11 | [
"https://wordpress.stackexchange.com/questions/354396",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/179639/"
] | I need to get some random posts and order them by date.
To get random posts I used the following:
```
$query = new WP_Query(
[
'post__in' => $post_id_array,
'posts_per_page' => $number,
'orderby' => 'rand'
]
);
```
To order by date I tried this:
```
'orderby' => ['rand' => 'ASC', 'date'... | I found the culprit!
WordPress 5.3 introduced additional image sizes which can be found via `/wp-includes/media.php`.
Updating my function, like so, removed the extra sizes:
```
function remove_default_image_sizes( $sizes) {
unset( $sizes['large']); // Added to remove 1024
unset( $sizes['thumbnail']);
u... |
354,410 | <p>I have a class setup to run some database scripts on my mu-plugin.</p>
<pre><code>function activate_mjmc_core() {
require_once plugin_dir_path( __FILE__ ) . 'includes/class-mjmc-core-activator.php';
Mjmc_Core_Activator::activate();
Mjmc_Core_Activator::mjmc_database_version();
Mjmc_Core_Activator::mjmc_companie... | [
{
"answer_id": 354411,
"author": "Jacob Peattie",
"author_id": 39152,
"author_profile": "https://wordpress.stackexchange.com/users/39152",
"pm_score": 3,
"selected": true,
"text": "<p>MU plugins don't 'activate', or 'deactivate'. They're just present or not present. So you'll need a diff... | 2019/12/12 | [
"https://wordpress.stackexchange.com/questions/354410",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/179644/"
] | I have a class setup to run some database scripts on my mu-plugin.
```
function activate_mjmc_core() {
require_once plugin_dir_path( __FILE__ ) . 'includes/class-mjmc-core-activator.php';
Mjmc_Core_Activator::activate();
Mjmc_Core_Activator::mjmc_database_version();
Mjmc_Core_Activator::mjmc_companies_table();
Mj... | MU plugins don't 'activate', or 'deactivate'. They're just present or not present. So you'll need a different approach. One option would be to just perform your activation functions on `init`, and store a record in the database to say whether or not it's already been done:
```
function activate_mjmc_core() {
if ( ... |
354,415 | <p>I currently have a front end part of a WP site that allows admins to create new users and assign then user roles from a drop down - that works perfectly.</p>
<p>However, I am using a plugin to also authenticate users against an AD/LDAP so I can use it on a corporate level too.</p>
<p>The problem is when the user a... | [
{
"answer_id": 354411,
"author": "Jacob Peattie",
"author_id": 39152,
"author_profile": "https://wordpress.stackexchange.com/users/39152",
"pm_score": 3,
"selected": true,
"text": "<p>MU plugins don't 'activate', or 'deactivate'. They're just present or not present. So you'll need a diff... | 2019/12/12 | [
"https://wordpress.stackexchange.com/questions/354415",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17411/"
] | I currently have a front end part of a WP site that allows admins to create new users and assign then user roles from a drop down - that works perfectly.
However, I am using a plugin to also authenticate users against an AD/LDAP so I can use it on a corporate level too.
The problem is when the user authenticates agai... | MU plugins don't 'activate', or 'deactivate'. They're just present or not present. So you'll need a different approach. One option would be to just perform your activation functions on `init`, and store a record in the database to say whether or not it's already been done:
```
function activate_mjmc_core() {
if ( ... |
354,418 | <p>I am working on search. I am trying to search the product by tag or category. I tried below code but it's not working. I am getting </p>
<blockquote>
<p>Nothing Found</p>
</blockquote>
<p>Also title and content is also not working.</p>
<p>Would you help me out in this?</p>
<pre><code><?php
/**
* The templa... | [
{
"answer_id": 354411,
"author": "Jacob Peattie",
"author_id": 39152,
"author_profile": "https://wordpress.stackexchange.com/users/39152",
"pm_score": 3,
"selected": true,
"text": "<p>MU plugins don't 'activate', or 'deactivate'. They're just present or not present. So you'll need a diff... | 2019/12/12 | [
"https://wordpress.stackexchange.com/questions/354418",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/177715/"
] | I am working on search. I am trying to search the product by tag or category. I tried below code but it's not working. I am getting
>
> Nothing Found
>
>
>
Also title and content is also not working.
Would you help me out in this?
```
<?php
/**
* The template for displaying search results pages
*
* @link ht... | MU plugins don't 'activate', or 'deactivate'. They're just present or not present. So you'll need a different approach. One option would be to just perform your activation functions on `init`, and store a record in the database to say whether or not it's already been done:
```
function activate_mjmc_core() {
if ( ... |
354,427 | <p>I'm using WPMU in my project, but I'm facing some problems to get the current post id from all sites. If I run this code, I receive the same post id of current site and not the different post id from all other sites. It's like that <code>switch_to_blog</code> doesn't work. How can I get all ids of current post from ... | [
{
"answer_id": 354431,
"author": "Hasan Uj Jaman",
"author_id": 179656,
"author_profile": "https://wordpress.stackexchange.com/users/179656",
"pm_score": 0,
"selected": false,
"text": "<p>use <code>global $post</code>. And use <code>$post->ID</code></p>\n"
},
{
"answer_id": 35... | 2019/12/12 | [
"https://wordpress.stackexchange.com/questions/354427",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/174178/"
] | I'm using WPMU in my project, but I'm facing some problems to get the current post id from all sites. If I run this code, I receive the same post id of current site and not the different post id from all other sites. It's like that `switch_to_blog` doesn't work. How can I get all ids of current post from all sites?
``... | try this
```
$sites = get_sites();
global $switched;
/** @var WP_Site $site */
foreach ($sites as $site) {
if ( $site->archived || $site->spam || $site->deleted ) {
continue;
}
switch_to_blog( $site->blog_id );
$all_posts = get_posts('category=-3&numberposts=6&orderby=post_name&order=DSC');
?>
<ul>
<?php foreach... |
354,433 | <p>I have Two Custom Post Types "Article " & "News" and they both use same categories
like [ audit , income , tax] . I want when i open audit category page then the post showsn like below: <a href="https://i.stack.imgur.com/CUG4T.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CUG4T.png" alt="ent... | [
{
"answer_id": 354435,
"author": "Heba Fareed",
"author_id": 179666,
"author_profile": "https://wordpress.stackexchange.com/users/179666",
"pm_score": 1,
"selected": false,
"text": "<p>First, I would recommend making this change in Category.php file, as archive.php is affecting tags as w... | 2019/12/12 | [
"https://wordpress.stackexchange.com/questions/354433",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/165598/"
] | I have Two Custom Post Types "Article " & "News" and they both use same categories
like [ audit , income , tax] . I want when i open audit category page then the post showsn like below: [](https://i.stack.imgur.com/CUG4T.png)
the code i already tried ... | Its Done Thank U so much Everyone Who Answered!
```
<?php
/*
* dglib_breadcrumbs_section_template - hook
*
* @hooked - dglib_breadcrumbs_section_callback - 10
*
* @since 1.0.6
*/
do_action( 'dglib_breadcrumbs_section_template' );
?>
<div id="primary" class="content-area">
<main id="main" class="site... |
354,492 | <p>In .js file of a theme, there are the 2 events using one function:</p>
<pre><code>$j( window ).on( 'load', function() {
functionName();
} );
$j( document ).ajaxComplete( function() {
functionName();
} );
</code></pre>
<p>I would like to stop it from executing through either functions.php or my own p... | [
{
"answer_id": 354503,
"author": "Raba",
"author_id": 127210,
"author_profile": "https://wordpress.stackexchange.com/users/127210",
"pm_score": 3,
"selected": true,
"text": "<p>We need to know how the script is being enqueued, but if it's done right, you will be able to remove that <code... | 2019/12/12 | [
"https://wordpress.stackexchange.com/questions/354492",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/153903/"
] | In .js file of a theme, there are the 2 events using one function:
```
$j( window ).on( 'load', function() {
functionName();
} );
$j( document ).ajaxComplete( function() {
functionName();
} );
```
I would like to stop it from executing through either functions.php or my own plugin because I already ha... | We need to know how the script is being enqueued, but if it's done right, you will be able to remove that `.js` file using `wp_dequeue_script`.
### How to correctly enqueue scripts
```
function my_register_script()
//Registers a script to be enqueued later
wp_register_script('script-handle', plugins_url('scri... |
354,639 | <p>I have a grid setup on my portfolio page and for whatever reason I keep getting these two errors:</p>
<blockquote>
<p>Notice: Undefined variable: thumbnail in
/home/hometo10/public_html/wp-content/themes/swank/archive-portfolio.php
on line 22</p>
<p>Notice: Trying to get property of non-object in
/home... | [
{
"answer_id": 354642,
"author": "Tom J Nowell",
"author_id": 736,
"author_profile": "https://wordpress.stackexchange.com/users/736",
"pm_score": 1,
"selected": false,
"text": "<p>It is complaining that <code>$thumbnail</code> is undefined because it's undefined, unknown, it's been pulle... | 2019/12/15 | [
"https://wordpress.stackexchange.com/questions/354639",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/179788/"
] | I have a grid setup on my portfolio page and for whatever reason I keep getting these two errors:
>
> Notice: Undefined variable: thumbnail in
> /home/hometo10/public\_html/wp-content/themes/swank/archive-portfolio.php
> on line 22
>
>
> Notice: Trying to get property of non-object in
> /home/hometo10/public\_ht... | It is complaining that `$thumbnail` is undefined because it's undefined, unknown, it's been pulled out of thin air.
```
echo get_the_post_thumbnail($thumbnail->ID, 'portfolio-featured');
```
This, is the very first time `$thumbnail` is mentioned, where did it come from? ¯\\_(ツ)\_/¯ I have no idea and neither does PH... |
354,641 | <p>On a WordPress page I have a number of H2 headings followed by some text. </p>
<p>I'm trying to group all these blocks along with a common background color so that it looks neat and organized. </p>
<p>Here is a crude example of what I'm trying to achieve in WordPress. Notice the background color goes across the bl... | [
{
"answer_id": 354650,
"author": "Raba",
"author_id": 127210,
"author_profile": "https://wordpress.stackexchange.com/users/127210",
"pm_score": 3,
"selected": true,
"text": "<p>You should group your blocks inside a container block that lets you choose its background color.</p>\n\n<p>I'm ... | 2019/12/15 | [
"https://wordpress.stackexchange.com/questions/354641",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/167402/"
] | On a WordPress page I have a number of H2 headings followed by some text.
I'm trying to group all these blocks along with a common background color so that it looks neat and organized.
Here is a crude example of what I'm trying to achieve in WordPress. Notice the background color goes across the blocks:
```
A ... | You should group your blocks inside a container block that lets you choose its background color.
I'm going to give you a couple of options, ordered by accessibility.
Grouped Blocks
==============
For **WordPress 5.3+**, there is the **Group** block that lets you group blocks and select a background color. Check Toms... |
354,655 | <p>I'm working on a personal project which includes multiple custom fields (created via ACF). A few of them are repeater types. </p>
<p>I want to to display 3 arrays/blocks of those repeater subfield values. For better understanding, I have this repeater field: open_workshops, and this field includes subfields: date, ... | [
{
"answer_id": 354851,
"author": "Bhupen",
"author_id": 128529,
"author_profile": "https://wordpress.stackexchange.com/users/128529",
"pm_score": 0,
"selected": false,
"text": "<p>Have you tried passing post id? Please see below:</p>\n\n<pre><code>if( have_rows('parent_field', $post_id) ... | 2019/12/15 | [
"https://wordpress.stackexchange.com/questions/354655",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/25217/"
] | I'm working on a personal project which includes multiple custom fields (created via ACF). A few of them are repeater types.
I want to to display 3 arrays/blocks of those repeater subfield values. For better understanding, I have this repeater field: open\_workshops, and this field includes subfields: date, location,... | I don't think ACF has a built-in function to do what you want. You can use [get\_field](https://www.advancedcustomfields.com/resources/get_field/) to retrieve a value from any post, but it requires a post ID if you want the value from anything other than the current post.
So instead, we can query posts using [WP\_Quer... |