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 |
|---|---|---|---|---|---|---|
324,079 | <p>I want to give a post a classname on the homepage (index) if the post on the single page has no content. So when the post itself exists but there is no content, I want to give a classname to that specific post/article which will be shown on the homepage.</p>
<p>My question: can this be done? If so, how?</p>
| [
{
"answer_id": 324087,
"author": "Frank P. Walentynowicz",
"author_id": 32851,
"author_profile": "https://wordpress.stackexchange.com/users/32851",
"pm_score": 1,
"selected": false,
"text": "<p>As Tom J Nowell mentioned in his comment, it is not clear what do you want to accomplish. If y... | 2018/12/28 | [
"https://wordpress.stackexchange.com/questions/324079",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/62192/"
] | I want to give a post a classname on the homepage (index) if the post on the single page has no content. So when the post itself exists but there is no content, I want to give a classname to that specific post/article which will be shown on the homepage.
My question: can this be done? If so, how? | As Tom J Nowell mentioned in his comment, it is not clear what do you want to accomplish. If you want to just show your empty content `div`, you can use CSS as follows:
```
div:empty {
width: 100%;
height: 20px;
margin-bottom: 10px;
background: #ff0000;
}
```
It will show your empty content `div` as ... |
324,091 | <p>I'm trying to create custom columns block in Gutenberg.
Is it possible to add class to the wrapper of the element in the editor based on the attributes? I'd like to switch <code>???</code> to class based e.g. <code>columns-4</code>. Otherwise it's not possible to use <code>flex</code>. </p>
<pre><code><div id=".... | [
{
"answer_id": 324095,
"author": "Runnick",
"author_id": 121208,
"author_profile": "https://wordpress.stackexchange.com/users/121208",
"pm_score": 4,
"selected": true,
"text": "<p>Actually it can be done with the <a href=\"https://wordpress.org/gutenberg/handbook/designers-developers/dev... | 2018/12/28 | [
"https://wordpress.stackexchange.com/questions/324091",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/121208/"
] | I'm trying to create custom columns block in Gutenberg.
Is it possible to add class to the wrapper of the element in the editor based on the attributes? I'd like to switch `???` to class based e.g. `columns-4`. Otherwise it's not possible to use `flex`.
```
<div id="..." class="wp-block editor-block-list__block ???" ... | Actually it can be done with the [filter](https://wordpress.org/gutenberg/handbook/designers-developers/developers/filters/block-filters/#editor-blocklistblock):
```
const { createHigherOrderComponent } = wp.compose;
const withCustomClassName = createHigherOrderComponent( ( BlockListBlock ) => {
return ( props ) =... |
324,127 | <p>I have this PHP code that shows a related posts element created using advanced custom fields plugin. I want to create a shortcode inside functions.php with the code and then use the shortcode in a text element of a page builder. Would someone kindly assist me with the modified code to put inside functions.php? Thank... | [
{
"answer_id": 324108,
"author": "John Dee",
"author_id": 131224,
"author_profile": "https://wordpress.stackexchange.com/users/131224",
"pm_score": 0,
"selected": false,
"text": "<p>Just delete the data from what you're showing the client. If a person doesn't understand what the API is, ... | 2018/12/29 | [
"https://wordpress.stackexchange.com/questions/324127",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | I have this PHP code that shows a related posts element created using advanced custom fields plugin. I want to create a shortcode inside functions.php with the code and then use the shortcode in a text element of a page builder. Would someone kindly assist me with the modified code to put inside functions.php? Thanks
... | I'm not entirely sure what will be better explanation, or why this one (the real one) is not enough.
In your stats you see URLs of requests and not paths to files. URL has nothing to do with files on server.
Yes - if the requests targets physical file, then that file exists, but... There are plenty URLs that are not ... |
324,158 | <p>I have a blank theme purely to redirect to my custom front-end. I created a <code>functions.php</code> and put <code>add_theme_support()</code> inside it and to no avail.</p>
<p>index.php:</p>
<pre><code><meta content="0; URL='https://headless-cms.test''" http-equiv"refresh">
<!-- just in case the meta ... | [
{
"answer_id": 324131,
"author": "Md. Ehsanul Haque Kanan",
"author_id": 75705,
"author_profile": "https://wordpress.stackexchange.com/users/75705",
"pm_score": 1,
"selected": true,
"text": "<p>You can try using <a href=\"https://wordpress.org/plugins/bulkpress/\" rel=\"nofollow noreferr... | 2018/12/29 | [
"https://wordpress.stackexchange.com/questions/324158",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/145214/"
] | I have a blank theme purely to redirect to my custom front-end. I created a `functions.php` and put `add_theme_support()` inside it and to no avail.
index.php:
```
<meta content="0; URL='https://headless-cms.test''" http-equiv"refresh">
<!-- just in case the meta tag is not read properly, here is plan B: a JS redire... | You can try using [BulkPress](https://wordpress.org/plugins/bulkpress/). It allows you to create hundreds of categories very easily. Follow these steps:
1. Install and activate the plugin.
2. In the left side bar, hover your cursor on **Bulkpress**. Then click
on **Terms**.
3. A new page will appear. In **Taxonomy** f... |
324,174 | <p>can anyone help me i am trying to create a plugin for gallery but at the initiating
a problem occurred,when i activate the plugin it activating but problem is that it does not appearing at left menu ,</p>
<p><code>this is my code of plugin startup:|</code></p>
<pre><code><?php
/*
Plugin Name:JaissGallery
Plugin... | [
{
"answer_id": 324131,
"author": "Md. Ehsanul Haque Kanan",
"author_id": 75705,
"author_profile": "https://wordpress.stackexchange.com/users/75705",
"pm_score": 1,
"selected": true,
"text": "<p>You can try using <a href=\"https://wordpress.org/plugins/bulkpress/\" rel=\"nofollow noreferr... | 2018/12/29 | [
"https://wordpress.stackexchange.com/questions/324174",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/144155/"
] | can anyone help me i am trying to create a plugin for gallery but at the initiating
a problem occurred,when i activate the plugin it activating but problem is that it does not appearing at left menu ,
`this is my code of plugin startup:|`
```
<?php
/*
Plugin Name:JaissGallery
Plugin URI:WWW.GOOGLE.COM
description: >-... | You can try using [BulkPress](https://wordpress.org/plugins/bulkpress/). It allows you to create hundreds of categories very easily. Follow these steps:
1. Install and activate the plugin.
2. In the left side bar, hover your cursor on **Bulkpress**. Then click
on **Terms**.
3. A new page will appear. In **Taxonomy** f... |
324,209 | <p>I'm still learning PHP and MySQL and need to create a unique number in Wordpress site (as a order number ID) every time, when user fill and submit "order" form from frontend and save it to database. Next submit will create a number+1. Website is not running on Woocommerce. No cart, checkout, products...</p>
<p>Than... | [
{
"answer_id": 324212,
"author": "Md. Ehsanul Haque Kanan",
"author_id": 75705,
"author_profile": "https://wordpress.stackexchange.com/users/75705",
"pm_score": -1,
"selected": false,
"text": "<p>You can get the unique ID number by using the merge tag {submission:sequence}. It allows you... | 2018/12/30 | [
"https://wordpress.stackexchange.com/questions/324209",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/157966/"
] | I'm still learning PHP and MySQL and need to create a unique number in Wordpress site (as a order number ID) every time, when user fill and submit "order" form from frontend and save it to database. Next submit will create a number+1. Website is not running on Woocommerce. No cart, checkout, products...
Thanks for hel... | in order to do this use
```
AUTO_INCREMENT PRIMARY KEY
```
while you define your table. Your table should be something like this:
```
CREATE TABLE `order` (
`order_id` INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
`user_group_id` INT(11) UNSIGNED NOT NULL,
`status` BIT,
... |
324,221 | <p>I have this custom post type:</p>
<pre><code>function create_posttype() {
register_post_type( 'companies',
array(
'labels' => array(
'name' => __( 'شرکتهای عضو' ),
'singular_name' => __( 'شرکت' )
),
'supports' => array('title', 'editor', 'custom-fields', 'excerpt'... | [
{
"answer_id": 324222,
"author": "Alvaro",
"author_id": 16533,
"author_profile": "https://wordpress.stackexchange.com/users/16533",
"pm_score": 7,
"selected": true,
"text": "<p>For Gutenberg to work in a Custom Post Type you need to enable both the <code>editor</code> in <code>supports</... | 2018/12/30 | [
"https://wordpress.stackexchange.com/questions/324221",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/109403/"
] | I have this custom post type:
```
function create_posttype() {
register_post_type( 'companies',
array(
'labels' => array(
'name' => __( 'شرکتهای عضو' ),
'singular_name' => __( 'شرکت' )
),
'supports' => array('title', 'editor', 'custom-fields', 'excerpt', 'thumbnail'),
'pub... | For Gutenberg to work in a Custom Post Type you need to enable both the `editor` in `supports` (which you already have) and `show_in_rest`. So add `'show_in_rest' => true,` to your post registration arguments array. |
324,229 | <p>I'm currently using this code within my plugin on a custom widgets textarea to enable codemirror.</p>
<pre><code>(function ($) {
$(document).ready( function(){
var coinmedi_es_<?php echo $wid_id; ?> = wp.codeEditor.defaultSettings ? _.clone( wp.codeEditor.defaultSettings ) : {};
... | [
{
"answer_id": 324222,
"author": "Alvaro",
"author_id": 16533,
"author_profile": "https://wordpress.stackexchange.com/users/16533",
"pm_score": 7,
"selected": true,
"text": "<p>For Gutenberg to work in a Custom Post Type you need to enable both the <code>editor</code> in <code>supports</... | 2018/12/30 | [
"https://wordpress.stackexchange.com/questions/324229",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/155953/"
] | I'm currently using this code within my plugin on a custom widgets textarea to enable codemirror.
```
(function ($) {
$(document).ready( function(){
var coinmedi_es_<?php echo $wid_id; ?> = wp.codeEditor.defaultSettings ? _.clone( wp.codeEditor.defaultSettings ) : {};
coinmedi_es_... | For Gutenberg to work in a Custom Post Type you need to enable both the `editor` in `supports` (which you already have) and `show_in_rest`. So add `'show_in_rest' => true,` to your post registration arguments array. |
324,230 | <p>I have a freelancer working on a program for me. </p>
<p>I gave him access to the theme folder via FTP. He uploaded <a href="http://phpminiadmin.sourceforge.net/" rel="nofollow noreferrer">phpMiniAdmin</a> to that folder and, somehow, obtained the database credentials, which he then used to sign in. </p>
<p>How di... | [
{
"answer_id": 324231,
"author": "Jacob Peattie",
"author_id": 39152,
"author_profile": "https://wordpress.stackexchange.com/users/39152",
"pm_score": 2,
"selected": false,
"text": "<p>If they can upload files then they can upload a php file that can read the database credentials from wp... | 2018/12/30 | [
"https://wordpress.stackexchange.com/questions/324230",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/136273/"
] | I have a freelancer working on a program for me.
I gave him access to the theme folder via FTP. He uploaded [phpMiniAdmin](http://phpminiadmin.sourceforge.net/) to that folder and, somehow, obtained the database credentials, which he then used to sign in.
How did he manage to obtain those credentials? Is there a vu... | All he needed to do is to put this PHP code in any template file and run it:
```
var_dump(DB_NAME, DB_USER, DB_PASSWORD, DB_HOST);
```
One line and it will print all the DB credentials.
As you can see - no vulnerabilities are needed.
All PHP code has access to these credentials. And it has to - otherwise it would... |
324,243 | <p>I'm working on converting my old NucleusCMS blogs to WordPress. I have created a set of tables locally and began the conversion process. I've been fine right up to image "conversion". I think I can pull the old image and add it to the library using <a href="https://wordpress.stackexchange.com/questions/238... | [
{
"answer_id": 340400,
"author": "Antti Koskinen",
"author_id": 144392,
"author_profile": "https://wordpress.stackexchange.com/users/144392",
"pm_score": 1,
"selected": false,
"text": "<p>Building upon the accepted answer on the linked question, I think something like this might work.</p... | 2018/12/30 | [
"https://wordpress.stackexchange.com/questions/324243",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/109240/"
] | I'm working on converting my old NucleusCMS blogs to WordPress. I have created a set of tables locally and began the conversion process. I've been fine right up to image "conversion". I think I can pull the old image and add it to the library using [this answer](https://wordpress.stackexchange.com/questions/238294/prog... | Hey I used this code for something similar(I was also downloading remote image and uploading to WordPress site). Please have a look:
```
$image_url = $value;//This is the sanitized image url.
$image = pathinfo($image_url);//Extracting information into array.
$image_name = $image['basename'];
$upload_dir = wp_upload_di... |
324,244 | <p>So I am trying to add a button at the end of my blog posts, here is the code I have in the plugin so far: </p>
<pre><code><?php
/*
Plugin Name: etc....
*/
function shares_content() { ?>
<div class='social-shares-container'>
<a href='https://www.facebook.com/sharer/sharer.php?u=<?php echo th... | [
{
"answer_id": 324246,
"author": "Krzysiek Dróżdż",
"author_id": 34172,
"author_profile": "https://wordpress.stackexchange.com/users/34172",
"pm_score": 0,
"selected": false,
"text": "<p>In this line:</p>\n\n<pre><code>return $content . shares_content();\n</code></pre>\n\n<p>You concaten... | 2018/12/30 | [
"https://wordpress.stackexchange.com/questions/324244",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/155705/"
] | So I am trying to add a button at the end of my blog posts, here is the code I have in the plugin so far:
```
<?php
/*
Plugin Name: etc....
*/
function shares_content() { ?>
<div class='social-shares-container'>
<a href='https://www.facebook.com/sharer/sharer.php?u=<?php echo the_permalink(); ?>'>Share on Face... | Your `shares_content` function directly outputs content, which won't work if you're trying to assign the results to a variable or use it in a `return` statement within another function.
You can change it to `return` the string:
```
function shares_content() {
$content = "<div class='social-shares-container'><a hr... |
324,306 | <p>When I visit website using Wordpress Dashboard, browser is showing 'cPanel, Inc. Certification Authority';</p>
<p><a href="https://i.stack.imgur.com/u0wYQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/u0wYQ.png" alt="enter image description here"></a></p>
<p>But, when I access it directly typi... | [
{
"answer_id": 324246,
"author": "Krzysiek Dróżdż",
"author_id": 34172,
"author_profile": "https://wordpress.stackexchange.com/users/34172",
"pm_score": 0,
"selected": false,
"text": "<p>In this line:</p>\n\n<pre><code>return $content . shares_content();\n</code></pre>\n\n<p>You concaten... | 2018/12/31 | [
"https://wordpress.stackexchange.com/questions/324306",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/158048/"
] | When I visit website using Wordpress Dashboard, browser is showing 'cPanel, Inc. Certification Authority';
[](https://i.stack.imgur.com/u0wYQ.png)
But, when I access it directly typing the domain in the URL Bar, no Certification icon is being display... | Your `shares_content` function directly outputs content, which won't work if you're trying to assign the results to a variable or use it in a `return` statement within another function.
You can change it to `return` the string:
```
function shares_content() {
$content = "<div class='social-shares-container'><a hr... |
324,320 | <p>I'm using a plugin (Comet Cache) to save static versions of a particular page I have on my site. </p>
<p>Inside the plugin, I have the cache set to clear every 2 hours (that way this page can show the latest, non-cached) version of data its pulling from. </p>
<p>The only issue is, for this page to get cached again... | [
{
"answer_id": 324246,
"author": "Krzysiek Dróżdż",
"author_id": 34172,
"author_profile": "https://wordpress.stackexchange.com/users/34172",
"pm_score": 0,
"selected": false,
"text": "<p>In this line:</p>\n\n<pre><code>return $content . shares_content();\n</code></pre>\n\n<p>You concaten... | 2018/12/31 | [
"https://wordpress.stackexchange.com/questions/324320",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/145165/"
] | I'm using a plugin (Comet Cache) to save static versions of a particular page I have on my site.
Inside the plugin, I have the cache set to clear every 2 hours (that way this page can show the latest, non-cached) version of data its pulling from.
The only issue is, for this page to get cached again, someone has to ... | Your `shares_content` function directly outputs content, which won't work if you're trying to assign the results to a variable or use it in a `return` statement within another function.
You can change it to `return` the string:
```
function shares_content() {
$content = "<div class='social-shares-container'><a hr... |
324,327 | <p><strong>Scenario</strong></p>
<p>I'm considering writing a custom wp-json endpoint to list ALL permalinks for everyone post in my wordpress.</p>
<p><strong>Question</strong></p>
<p>Is it possible to do this with a rest query + filters? eg. <a href="http://wpsite.com/wp-json/wp/v2/posts?filter%5Bonly-permalinks%5D" r... | [
{
"answer_id": 324332,
"author": "Justin Waulters",
"author_id": 137235,
"author_profile": "https://wordpress.stackexchange.com/users/137235",
"pm_score": 2,
"selected": false,
"text": "<p>I don't believe there is a default endpoint to let you get <em>all</em> the posts and return <em>on... | 2018/12/31 | [
"https://wordpress.stackexchange.com/questions/324327",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/13170/"
] | **Scenario**
I'm considering writing a custom wp-json endpoint to list ALL permalinks for everyone post in my wordpress.
**Question**
Is it possible to do this with a rest query + filters? eg. [http://wpsite.com/wp-json/wp/v2/posts?filter[only-permalinks]](http://wpsite.com/wp-json/wp/v2/posts?filter%5Bonly-permalin... | >
> Is it possible to do this with a rest query + filters? eg.
> <http://wpsite.com/wp-json/wp/v2/posts?filter[only-permalinks]>
>
>
>
Yes, since 4.9.8 (see [#43874](https://core.trac.wordpress.org/ticket/43874)) it's possible to render only fields needed with the `_fields` parameter.
Examples
--------
Render o... |
324,345 | <p>i moved my site from http to https
now i want to redirect the user into the new url but evry time i'm trying to edit .htaccess file i'm getting an error </p>
<p>this is the working file content where xxxz is site name</p>
<pre><code># BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
R... | [
{
"answer_id": 324355,
"author": "Md. Ehsanul Haque Kanan",
"author_id": 75705,
"author_profile": "https://wordpress.stackexchange.com/users/75705",
"pm_score": 0,
"selected": false,
"text": "<p>The best way for setting up Permanent 301 Redirects is by editing .htaccess with the required... | 2019/01/01 | [
"https://wordpress.stackexchange.com/questions/324345",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/82887/"
] | i moved my site from http to https
now i want to redirect the user into the new url but evry time i'm trying to edit .htaccess file i'm getting an error
this is the working file content where xxxz is site name
```
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [... | >
>
> ```
> RewriteCond %{HTTP_HOST} ^xxxz.com.qa [NC,OR]
> RewriteCond %{HTTP_HOST} ^www.xxxz.com.qa [NC]
> RewriteRule ^(.*)$ https://www.xxxz.com.qa/$1 [L,R=301,NC]
>
> ```
>
>
This will result in a redirect loop as it will repeatedly redirect `https://www.xxxz.com.qa/<url>` to `https://www.xxxz.com.qa/<url>` ... |
324,441 | <p>How do I get all terms matching:</p>
<ol>
<li>custom taxonomy "<code>company</code>"</li>
<li>only where term meta (ACF field) "<code>tags</code>" value matches a given string, "<code>Publishing</code>"</li>
<li>only if the term has any posts of custom type "<code>article</code>"</li>
<li>but those posts must only ... | [
{
"answer_id": 324355,
"author": "Md. Ehsanul Haque Kanan",
"author_id": 75705,
"author_profile": "https://wordpress.stackexchange.com/users/75705",
"pm_score": 0,
"selected": false,
"text": "<p>The best way for setting up Permanent 301 Redirects is by editing .htaccess with the required... | 2019/01/02 | [
"https://wordpress.stackexchange.com/questions/324441",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/39300/"
] | How do I get all terms matching:
1. custom taxonomy "`company`"
2. only where term meta (ACF field) "`tags`" value matches a given string, "`Publishing`"
3. only if the term has any posts of custom type "`article`"
4. but those posts must only have a taxonomy "`format`" value of term "`viewpoint`" or one of its childr... | >
>
> ```
> RewriteCond %{HTTP_HOST} ^xxxz.com.qa [NC,OR]
> RewriteCond %{HTTP_HOST} ^www.xxxz.com.qa [NC]
> RewriteRule ^(.*)$ https://www.xxxz.com.qa/$1 [L,R=301,NC]
>
> ```
>
>
This will result in a redirect loop as it will repeatedly redirect `https://www.xxxz.com.qa/<url>` to `https://www.xxxz.com.qa/<url>` ... |
324,447 | <p>www.beautifulcreationsphotography.co.uk</p>
<p>I have a client who used to have a Wordpress blog, however for some reason its carrying over to her new site and causing havok with Yoast.</p>
<p>Ive added in this filter below but it doesnt seem to have worked.</p>
<pre><code>add_filter( 'jetpack_enable_open_graph',... | [
{
"answer_id": 324448,
"author": "RiddleMeThis",
"author_id": 86845,
"author_profile": "https://wordpress.stackexchange.com/users/86845",
"pm_score": 0,
"selected": false,
"text": "<p>Make sure you are not seeing a cached version of the site.</p>\n\n<p>Also, try adding priority to the fi... | 2019/01/02 | [
"https://wordpress.stackexchange.com/questions/324447",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/23874/"
] | www.beautifulcreationsphotography.co.uk
I have a client who used to have a Wordpress blog, however for some reason its carrying over to her new site and causing havok with Yoast.
Ive added in this filter below but it doesnt seem to have worked.
```
add_filter( 'jetpack_enable_open_graph', '__return_false' );
```
A... | The site above does not use Jetpack's Open Graph Meta Tags. It uses Yoast SEO's own tags. In fact, on any site, if you use the Yoast SEO plugin and have activated the Open Graph meta tags under SEO > Social > Facebook, Jetpack's own Open Graph Meta Tags will never be added. Only the tags from Yoast will appear on your ... |
324,509 | <p>I tried it all and since i am not so good in this coding,
I want to hide a category and his posts from the homepage
I tried all plugins especially wp hide post but it needs pro version and seems Support is not answering on my emails so i rather do not buy that
i tried the code that i found everywhere see below,</p>... | [
{
"answer_id": 324473,
"author": "Krzysiek Dróżdż",
"author_id": 34172,
"author_profile": "https://wordpress.stackexchange.com/users/34172",
"pm_score": 0,
"selected": false,
"text": "<p>Function names have to be unique in PHP, so if some function is assigned to given hook, then there is... | 2019/01/03 | [
"https://wordpress.stackexchange.com/questions/324509",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/158239/"
] | I tried it all and since i am not so good in this coding,
I want to hide a category and his posts from the homepage
I tried all plugins especially wp hide post but it needs pro version and seems Support is not answering on my emails so i rather do not buy that
i tried the code that i found everywhere see below,
howev... | I read the whole core files in wordpress.
And it is split multiple file across the core folders actually it is very smart of them to do such a thing |
324,601 | <p><a href="https://i.stack.imgur.com/GMWYk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GMWYk.png" alt="enter image description here"></a></p>
<p>Hi, my website im doing now is nurulsazlinprubsntakaful.com</p>
<p>i want to delete home ---> Home as per pic i attach.</p>
<p>i read its about brea... | [
{
"answer_id": 324602,
"author": "Frank P. Walentynowicz",
"author_id": 32851,
"author_profile": "https://wordpress.stackexchange.com/users/32851",
"pm_score": 2,
"selected": true,
"text": "<p>First, check your theme's settings, if breadcrumbs can be turned on/off. If not, the following ... | 2019/01/04 | [
"https://wordpress.stackexchange.com/questions/324601",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/158296/"
] | [](https://i.stack.imgur.com/GMWYk.png)
Hi, my website im doing now is nurulsazlinprubsntakaful.com
i want to delete home ---> Home as per pic i attach.
i read its about breadcrumbs. i also use inspect function in web browser.i get code like this fr... | First, check your theme's settings, if breadcrumbs can be turned on/off. If not, the following CSS will hide breadcrumbs:
```
nav.breadcrumbs {
display: none;
}
```
Put the above lines, into Customize -> Additional CSS, or into your theme's `style.css`.
To remove sharing buttons, use the following CSS:
```
div... |
324,643 | <p>The WordPress block API for Gutenberg has a <code>withInstanceId</code> <a href="https://github.com/WordPress/gutenberg/tree/master/packages/compose/src/with-instance-id" rel="nofollow noreferrer">package</a>. </p>
<p>They say, </p>
<blockquote>
<p>Some components need to generate a unique id for each instance. ... | [
{
"answer_id": 324647,
"author": "Alvaro",
"author_id": 16533,
"author_profile": "https://wordpress.stackexchange.com/users/16533",
"pm_score": 2,
"selected": true,
"text": "<p>The generated <code>id</code> is added to the component's props. So it can be accessed through <code>this.props... | 2019/01/04 | [
"https://wordpress.stackexchange.com/questions/324643",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1613/"
] | The WordPress block API for Gutenberg has a `withInstanceId` [package](https://github.com/WordPress/gutenberg/tree/master/packages/compose/src/with-instance-id).
They say,
>
> Some components need to generate a unique id for each instance. This
> could serve as suffixes to element ID's for example. Wrapping a
> ... | The generated `id` is added to the component's props. So it can be accessed through `this.props.instanceId` inside the component.
In the example you posted it is being used to assign a unique [id attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id) to the html element. However it can be u... |
324,649 | <p>I have following scenario:</p>
<pre><code>my-domain-name.com/google.com
my-domain-name.com/twitter.com
</code></pre>
<p>I need a custom permalink structure to pass <code>google.com</code> or <code>twitter.com</code> to <code>domain_name</code> query variable.</p>
<p>I have tried following code:</p>
<pre><code>a... | [
{
"answer_id": 324713,
"author": "rifi2k",
"author_id": 158385,
"author_profile": "https://wordpress.stackexchange.com/users/158385",
"pm_score": 2,
"selected": false,
"text": "<p>I'm not sure if I should assume that you were issuing your examples inside of the init hook, but if not that... | 2019/01/04 | [
"https://wordpress.stackexchange.com/questions/324649",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/68993/"
] | I have following scenario:
```
my-domain-name.com/google.com
my-domain-name.com/twitter.com
```
I need a custom permalink structure to pass `google.com` or `twitter.com` to `domain_name` query variable.
I have tried following code:
```
add_rewrite_tag('%domain_name%', '([^&]+)');
add_rewrite_rule('^/([^/]*)/?','i... | The problem was solved by just one line of code. I am thankful to @rifi2k for long discussion and proposing different solutions.
Here is the solutions:
Add following code to functions.php
```
function custom_rewrite_basic() {
add_rewrite_tag('%domain_name%', '([a-z]{1,60}\.[a-z]{2,})');
}
add_action('init', 'cus... |
324,660 | <p>When trying to edit a wordpress post (page) the editor loads indefinitely, console shows JS error with post.php / polyfill, see code below. To me it seems to be a typo and I have no idea where the line is injected so I could change it manually. </p>
<p>Disabling all plugins did not change anything, neither did disa... | [
{
"answer_id": 325650,
"author": "Kostiantyn Petlia",
"author_id": 104932,
"author_profile": "https://wordpress.stackexchange.com/users/104932",
"pm_score": 2,
"selected": true,
"text": "<p>Here is an answer: <a href=\"https://wordpress.stackexchange.com/questions/325570/wordpress-v5-0-3... | 2019/01/04 | [
"https://wordpress.stackexchange.com/questions/324660",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/110944/"
] | When trying to edit a wordpress post (page) the editor loads indefinitely, console shows JS error with post.php / polyfill, see code below. To me it seems to be a typo and I have no idea where the line is injected so I could change it manually.
Disabling all plugins did not change anything, neither did disabling Gute... | Here is an answer: [WordPress v5.0.3 Gutenberg & JS error "Uncaught SyntaxError: missing ) after argument list"](https://wordpress.stackexchange.com/questions/325570/wordpress-v5-0-3-gutenberg-js-error-uncaught-syntaxerror-missing-after-arg)
The simplest way: Find & delete PHP Hook which added 'defer' to script (in th... |
324,751 | <p>I want to obtain a path of all parents for current page. Something similar to breadcrub but used only for pages listed in menu.</p>
<p>For example if i have following structure:</p>
<pre><code>L Menu
L Sub menu
L Current page
L Sub menu 2
L Menu 2
</code></pre>
<p>I want to obtain:</p>
<pre><code... | [
{
"answer_id": 324767,
"author": "Milo",
"author_id": 4771,
"author_profile": "https://wordpress.stackexchange.com/users/4771",
"pm_score": 3,
"selected": true,
"text": "<p>The <a href=\"https://developer.wordpress.org/reference/functions/wp_get_nav_menu_items/\" rel=\"nofollow noreferre... | 2019/01/05 | [
"https://wordpress.stackexchange.com/questions/324751",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/158330/"
] | I want to obtain a path of all parents for current page. Something similar to breadcrub but used only for pages listed in menu.
For example if i have following structure:
```
L Menu
L Sub menu
L Current page
L Sub menu 2
L Menu 2
```
I want to obtain:
```
Menu >> Sub Menu >> Current page
```
I am... | The [`wp_get_nav_menu_items`](https://developer.wordpress.org/reference/functions/wp_get_nav_menu_items/) function will give you an array of menu item objects for a given menu. These objects contain a mixture of data specific to that unique menu item, as well as the post/page/link data the menu item refers to. You can ... |
324,762 | <p>Based on research here and elsewhere, I have the following code that sets a cookie on a site:</p>
<pre><code>add_action( 'init', 'my_set_cookie',1 );
function my_set_cookie() {
if (! $_COOKIE['mycookie']) {
$guid = 'xxxx'; // normally a real guid value so it will be unique
setcookie('mycookie', $... | [
{
"answer_id": 324786,
"author": "Krzysiek Dróżdż",
"author_id": 34172,
"author_profile": "https://wordpress.stackexchange.com/users/34172",
"pm_score": 2,
"selected": false,
"text": "<p>It’s a problem as old as WP, or even older...</p>\n\n<p>You can’t set cookies, or send any other head... | 2019/01/06 | [
"https://wordpress.stackexchange.com/questions/324762",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/29416/"
] | Based on research here and elsewhere, I have the following code that sets a cookie on a site:
```
add_action( 'init', 'my_set_cookie',1 );
function my_set_cookie() {
if (! $_COOKIE['mycookie']) {
$guid = 'xxxx'; // normally a real guid value so it will be unique
setcookie('mycookie', $guid, time()+(... | After trying various hooks to try to set the cookie before the theme loaded it's header.php file (none of the hooks worked, even those very early in the 'load cycle'), I figure that I might temporarily disable the error so that the cookie can be set. I based my answer on [this question](https://stackoverflow.com/a/2615... |
324,795 | <pre><code>add_filter( 'woocommerce_order_button_text', 'woo_custom_order_button_text' );
function woo_custom_order_button_text() {
return __( 'Your new button text here', 'woocommerce' );
}
</code></pre>
<p>Above is the example how we can change the woocommerce "Place order" Text, but what if we want to change... | [
{
"answer_id": 324796,
"author": "Md. Ehsanul Haque Kanan",
"author_id": 75705,
"author_profile": "https://wordpress.stackexchange.com/users/75705",
"pm_score": 0,
"selected": false,
"text": "<p>You have to put your PHP codes at the bottom of <strong>functions.php</strong> file of your c... | 2019/01/06 | [
"https://wordpress.stackexchange.com/questions/324795",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/152578/"
] | ```
add_filter( 'woocommerce_order_button_text', 'woo_custom_order_button_text' );
function woo_custom_order_button_text() {
return __( 'Your new button text here', 'woocommerce' );
}
```
Above is the example how we can change the woocommerce "Place order" Text, but what if we want to change the CSS also how c... | I will try to answer your question. since you know how the text can be changed - let me take it for CSS.
View in the browser - The browser is rendering the button like this →
```
<button type="submit" class="button alt" name="woocommerce_checkout_place_order" id="place_order" value="Confirm order" data-value="Confi... |
324,908 | <p>I have been follow a tutorial here: <a href="https://rudrastyh.com/gutenberg/remove-default-blocks.html" rel="noreferrer">https://rudrastyh.com/gutenberg/remove-default-blocks.html</a> Where it discusses how to remove default Gutenberg blocks like so:</p>
<pre><code>add_filter( 'allowed_block_types', 'misha_allowed... | [
{
"answer_id": 324929,
"author": "birgire",
"author_id": 26350,
"author_profile": "https://wordpress.stackexchange.com/users/26350",
"pm_score": 5,
"selected": true,
"text": "<p>The <em>reusable block</em> is registered with the <code>core/block</code> name.</p>\n\n<p>I tried to add it t... | 2019/01/07 | [
"https://wordpress.stackexchange.com/questions/324908",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/153404/"
] | I have been follow a tutorial here: <https://rudrastyh.com/gutenberg/remove-default-blocks.html> Where it discusses how to remove default Gutenberg blocks like so:
```
add_filter( 'allowed_block_types', 'misha_allowed_block_types', 10, 2 );
function misha_allowed_block_types( $allowed_blocks, $post ) {
$allowed_bloc... | The *reusable block* is registered with the `core/block` name.
I tried to add it to the *allowed blocks* in the `allowed_block_types` filter, here's an example:
```
add_filter( 'allowed_block_types', 'wpse324908_allowed_block_types', 10, 2 );
function wpse324908_allowed_block_types( $allowed_blocks, $post ) {
... |
324,923 | <p>I'm a newbie at even trying to work with PHP, but thinking there may be a simple solution to this. EXIF exposure data is only displaying an "s", so there must be an error. </p>
<p>I'd also like to display FNumber as "Aperture" with common f-stop, such as "f2.8", but it shows a fraction 28/10. Is there PHP code t... | [
{
"answer_id": 324929,
"author": "birgire",
"author_id": 26350,
"author_profile": "https://wordpress.stackexchange.com/users/26350",
"pm_score": 5,
"selected": true,
"text": "<p>The <em>reusable block</em> is registered with the <code>core/block</code> name.</p>\n\n<p>I tried to add it t... | 2019/01/07 | [
"https://wordpress.stackexchange.com/questions/324923",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/158549/"
] | I'm a newbie at even trying to work with PHP, but thinking there may be a simple solution to this. EXIF exposure data is only displaying an "s", so there must be an error.
I'd also like to display FNumber as "Aperture" with common f-stop, such as "f2.8", but it shows a fraction 28/10. Is there PHP code that can be in... | The *reusable block* is registered with the `core/block` name.
I tried to add it to the *allowed blocks* in the `allowed_block_types` filter, here's an example:
```
add_filter( 'allowed_block_types', 'wpse324908_allowed_block_types', 10, 2 );
function wpse324908_allowed_block_types( $allowed_blocks, $post ) {
... |
324,927 | <p>I want to use the WYWISWYG on my blog page for an introduction text, but can't seem to bring back the WYSIWYG Editor on the page the page I defined as my blog posts page.</p>
<p>Is there any way to force WP to still show the WYSIWYG on the Blog posts page?</p>
<p><a href="https://i.stack.imgur.com/sjDej.png" rel="... | [
{
"answer_id": 324928,
"author": "RiddleMeThis",
"author_id": 86845,
"author_profile": "https://wordpress.stackexchange.com/users/86845",
"pm_score": 3,
"selected": true,
"text": "<p><strong>Pre WP 4.9</strong></p>\n\n<pre><code>if( ! function_exists( 'fix_no_editor_on_posts_page' ) ) {\... | 2019/01/07 | [
"https://wordpress.stackexchange.com/questions/324927",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8895/"
] | I want to use the WYWISWYG on my blog page for an introduction text, but can't seem to bring back the WYSIWYG Editor on the page the page I defined as my blog posts page.
Is there any way to force WP to still show the WYSIWYG on the Blog posts page?
[ ) {
/**
* Add the wp-editor back into WordPress after it was removed in 4.2.2.
*
* @param Object $post
* @return void
*/
function fix_no_editor_on_posts_page( $post ) {
if( isset( $post ) && $post->ID != get_... |
324,935 | <p>I have a WP site which I have not looked at for a while. I have just logged in to update aspects of it, including WP itself, now on 5.0.2. </p>
<p>Now if I click on any of the Dashboard links - Posts, Appearance etc - I get Page Not Found. If I delete the HTAccess then it works again ... until WP reinstates it. The... | [
{
"answer_id": 324936,
"author": "Highly Irregular",
"author_id": 76260,
"author_profile": "https://wordpress.stackexchange.com/users/76260",
"pm_score": 1,
"selected": false,
"text": "<p>I've had this issue on a small number of sites (out of around 60 that I help manage), and I'm wonder... | 2019/01/08 | [
"https://wordpress.stackexchange.com/questions/324935",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/38223/"
] | I have a WP site which I have not looked at for a while. I have just logged in to update aspects of it, including WP itself, now on 5.0.2.
Now if I click on any of the Dashboard links - Posts, Appearance etc - I get Page Not Found. If I delete the HTAccess then it works again ... until WP reinstates it. There is noth... | I've had this issue on a small number of sites (out of around 60 that I help manage), and I'm wondering if the issue is caused by caching (by a plugin or theme).
If you have a caching plugin, or a theme that does caching, there should be a tool in the Dashboard for emptying/clearing/deleting the cache. Click this, an... |
324,958 | <pre><code><?php function consultation_user_profile_fields($user){
if ( user_can( $user->ID, "subscriber" ) ) {
?>
<h3>Consultation</h3>
<?php $query = new WP_Query(
array(
'posts_per_page' => -1,
'post_type' => 'consultation',
'post_stat... | [
{
"answer_id": 324936,
"author": "Highly Irregular",
"author_id": 76260,
"author_profile": "https://wordpress.stackexchange.com/users/76260",
"pm_score": 1,
"selected": false,
"text": "<p>I've had this issue on a small number of sites (out of around 60 that I help manage), and I'm wonder... | 2019/01/08 | [
"https://wordpress.stackexchange.com/questions/324958",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/158575/"
] | ```
<?php function consultation_user_profile_fields($user){
if ( user_can( $user->ID, "subscriber" ) ) {
?>
<h3>Consultation</h3>
<?php $query = new WP_Query(
array(
'posts_per_page' => -1,
'post_type' => 'consultation',
'post_status' => 'publish'
)
);
... | I've had this issue on a small number of sites (out of around 60 that I help manage), and I'm wondering if the issue is caused by caching (by a plugin or theme).
If you have a caching plugin, or a theme that does caching, there should be a tool in the Dashboard for emptying/clearing/deleting the cache. Click this, an... |
324,962 | <p>I have a wordpress website in which I have a specific page for dictionary. This page is actually a custom page and does these things:</p>
<ul>
<li><code>site.com/dictionary</code> lists all the words</li>
<li><code>site.com/dictionary/?w=word</code> shows the definition of the word</li>
</ul>
<p>now I want the URL... | [
{
"answer_id": 324968,
"author": "André Kelling",
"author_id": 136930,
"author_profile": "https://wordpress.stackexchange.com/users/136930",
"pm_score": 1,
"selected": false,
"text": "<p>You can't just rewrite the URL.</p>\n\n<p>You would need to refactor a lot code when using that other... | 2019/01/08 | [
"https://wordpress.stackexchange.com/questions/324962",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/89930/"
] | I have a wordpress website in which I have a specific page for dictionary. This page is actually a custom page and does these things:
* `site.com/dictionary` lists all the words
* `site.com/dictionary/?w=word` shows the definition of the word
now I want the URL to be cleaned up and becomes like this:
```
site.com/di... | You can do this with the internal rewrite system, which is parsed in php, not htaccess.
First, add the rule. This assumes you have created a root page under `Pages` with the slug `dictionary`.
```
function wpd_dictionary_rewrite(){
add_rewrite_tag( '%dictionary_word%', '([^/]+)' );
add_rewrite_rule(
'... |
324,970 | <p>I was looking for a clean way to group my search results by posttype. I currently have 3 post types: <em>Page</em>, <em>Post</em> and <em>Glossary</em>. After a long search <a href="https://wordpress.stackexchange.com/a/181807/75046">this answer</a> in this thread got me what I needed. </p>
<p>The only problem is t... | [
{
"answer_id": 324971,
"author": "Community",
"author_id": -1,
"author_profile": "https://wordpress.stackexchange.com/users/-1",
"pm_score": -1,
"selected": false,
"text": "<p>Try to put <code><?php wp_reset_postdata(); ?></code> just after endif and check it is working or not and ... | 2019/01/08 | [
"https://wordpress.stackexchange.com/questions/324970",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/75046/"
] | I was looking for a clean way to group my search results by posttype. I currently have 3 post types: *Page*, *Post* and *Glossary*. After a long search [this answer](https://wordpress.stackexchange.com/a/181807/75046) in this thread got me what I needed.
The only problem is that there is no check for when a post type... | To avoid types with no results you can e.g.
* one additional time go through the loop and count the occurrences of each type, the number of returned results is not large (only 10 per page)
* display the type title when you encounter the first post with the given type (move to inside `while` loop, I know, less readable... |
324,979 | <p>I've registered a sidebar component in the block editor. I'd like to access the <code>state</code> of the component (<code>MyPlugin</code>) from outside of that component, in some arbitrary JavaScript in the same file. Is it possible to access the state via e.g. the <code>wp</code> object?</p>
<p>Or, is it possible... | [
{
"answer_id": 324980,
"author": "Sean",
"author_id": 138112,
"author_profile": "https://wordpress.stackexchange.com/users/138112",
"pm_score": 1,
"selected": false,
"text": "<p>I found a solution, but I'm not sure it's really the intended way to do this. I use the core editor datastore ... | 2019/01/08 | [
"https://wordpress.stackexchange.com/questions/324979",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/138112/"
] | I've registered a sidebar component in the block editor. I'd like to access the `state` of the component (`MyPlugin`) from outside of that component, in some arbitrary JavaScript in the same file. Is it possible to access the state via e.g. the `wp` object?
Or, is it possible, and would it be better to do this using `... | To do so you need to use a redux store. To register your own you can follow the steps in the [documentation](https://github.com/WordPress/gutenberg/tree/master/packages/data). Here is the minimum that should achieve what you are looking for.
First, lets give the "shape" of the store in the initial state object:
```
c... |
325,001 | <p>I would really like to keep my template files as clean as possible, without including too much argument data. Is it possible with the following example...</p>
<pre><code> $args = array(
'theme_location' => 'main-menu',
'menu_class' => 'list-inline',
'add_li_class' => 'list-inline-item... | [
{
"answer_id": 325020,
"author": "mrben522",
"author_id": 84703,
"author_profile": "https://wordpress.stackexchange.com/users/84703",
"pm_score": 2,
"selected": true,
"text": "<p>a function like this:</p>\n\n<pre><code>function get_nav_args($overrides = array()) {\n $defaults = array(... | 2019/01/08 | [
"https://wordpress.stackexchange.com/questions/325001",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/98671/"
] | I would really like to keep my template files as clean as possible, without including too much argument data. Is it possible with the following example...
```
$args = array(
'theme_location' => 'main-menu',
'menu_class' => 'list-inline',
'add_li_class' => 'list-inline-item'
);
wp_nav_menu(... | a function like this:
```
function get_nav_args($overrides = array()) {
$defaults = array(
'theme_location' => 'main-menu',
'menu_class' => 'list-inline',
'add_li_class' => 'list-inline-item',
);
return shortcode_atts($defaults, apply_filters('some_custom_identifier_nav_menu_args',... |
325,003 | <p>First please excuse my English. So I built my own WordPress theme and want to use ajax in it, I'm using ajax for change post category in my post loop inside functions.php, so when a person clicked the button in index.php ajax will send the data and functions.php will change the category, the problem is i can't reach... | [
{
"answer_id": 325020,
"author": "mrben522",
"author_id": 84703,
"author_profile": "https://wordpress.stackexchange.com/users/84703",
"pm_score": 2,
"selected": true,
"text": "<p>a function like this:</p>\n\n<pre><code>function get_nav_args($overrides = array()) {\n $defaults = array(... | 2019/01/08 | [
"https://wordpress.stackexchange.com/questions/325003",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/158580/"
] | First please excuse my English. So I built my own WordPress theme and want to use ajax in it, I'm using ajax for change post category in my post loop inside functions.php, so when a person clicked the button in index.php ajax will send the data and functions.php will change the category, the problem is i can't reach ad... | a function like this:
```
function get_nav_args($overrides = array()) {
$defaults = array(
'theme_location' => 'main-menu',
'menu_class' => 'list-inline',
'add_li_class' => 'list-inline-item',
);
return shortcode_atts($defaults, apply_filters('some_custom_identifier_nav_menu_args',... |
325,013 | <p>I am trying to query a custom taxonomy terms in a way that keeps the hierarchical structure. </p>
<p>Here is the code that I am using.. </p>
<pre><code>function ev_test_data() {
$title = 'Mens Levi\'s Jeans';
$titles = str_replace( array("'", '"', '-', '\\' ), '', explode( ' ', trim($title)) );
$cats... | [
{
"answer_id": 325016,
"author": "RiddleMeThis",
"author_id": 86845,
"author_profile": "https://wordpress.stackexchange.com/users/86845",
"pm_score": 0,
"selected": false,
"text": "<p>You can use <a href=\"https://developer.wordpress.org/reference/functions/wp_list_categories/#Display_Te... | 2019/01/08 | [
"https://wordpress.stackexchange.com/questions/325013",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/26991/"
] | I am trying to query a custom taxonomy terms in a way that keeps the hierarchical structure.
Here is the code that I am using..
```
function ev_test_data() {
$title = 'Mens Levi\'s Jeans';
$titles = str_replace( array("'", '"', '-', '\\' ), '', explode( ' ', trim($title)) );
$cats = array();
foreach... | I was looking for the same thing and think this should work for you : [Custom taxonomy, get\_the\_terms, listing in order of parent > child](https://wordpress.stackexchange.com/questions/37285/custom-taxonomy-get-the-terms-listing-in-order-of-parent-child) |
325,015 | <p>It works in the category.php loop</p>
<pre><code><article>
<p>post-<?php echo $wp_query->current_post +1; ?></p>
</article>
<article>
<p>post-<?php echo $wp_query->current_post +1; ?></p>
</article>
</code></pre>
<p>Result. Shows number 1, 2, 3 ...... | [
{
"answer_id": 325040,
"author": "EGWorldNP",
"author_id": 138428,
"author_profile": "https://wordpress.stackexchange.com/users/138428",
"pm_score": -1,
"selected": false,
"text": "<p>I didn't get what actually you are asking for ? Post count or Post ID <br><br>\nAs i understand, i assum... | 2019/01/08 | [
"https://wordpress.stackexchange.com/questions/325015",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | It works in the category.php loop
```
<article>
<p>post-<?php echo $wp_query->current_post +1; ?></p>
</article>
<article>
<p>post-<?php echo $wp_query->current_post +1; ?></p>
</article>
```
Result. Shows number 1, 2, 3 ...
```
<article>
<p>post-1</p>
</article>
<article>
<p>post-2</p>
</article>
```
Where to ... | It's not clearly stated in your question, but I guess, you added exactly this code to the widget file:
```
<?php echo $wp_query->current_post +1; ?>
```
Am I right?
If so, then it couldn't work, because this code takes the counter from global `$wp_query` object, but... This widget doesn't use global `$wp_query` and... |
325,022 | <p>I want to have what would appear if I chose
"homepage display to: Your latest posts"
but on a page of my choosing and Not as the front page of my site. </p>
| [
{
"answer_id": 325040,
"author": "EGWorldNP",
"author_id": 138428,
"author_profile": "https://wordpress.stackexchange.com/users/138428",
"pm_score": -1,
"selected": false,
"text": "<p>I didn't get what actually you are asking for ? Post count or Post ID <br><br>\nAs i understand, i assum... | 2019/01/08 | [
"https://wordpress.stackexchange.com/questions/325022",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/158618/"
] | I want to have what would appear if I chose
"homepage display to: Your latest posts"
but on a page of my choosing and Not as the front page of my site. | It's not clearly stated in your question, but I guess, you added exactly this code to the widget file:
```
<?php echo $wp_query->current_post +1; ?>
```
Am I right?
If so, then it couldn't work, because this code takes the counter from global `$wp_query` object, but... This widget doesn't use global `$wp_query` and... |
325,113 | <p>when I tried to edit a post of a custom post type, I experienced this error.</p>
<p><a href="https://i.stack.imgur.com/mWpXa.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mWpXa.jpg" alt="enter image description here"></a></p>
<p>When I press "Copy Error" I am getting this:</p>
<pre class="lan... | [
{
"answer_id": 325114,
"author": "marvinpoo",
"author_id": 94786,
"author_profile": "https://wordpress.stackexchange.com/users/94786",
"pm_score": 2,
"selected": true,
"text": "<p>So,\nI was researching this topic a bit deeper. All answers found on this SE suggested disabling Gutenberg w... | 2019/01/09 | [
"https://wordpress.stackexchange.com/questions/325113",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/94786/"
] | when I tried to edit a post of a custom post type, I experienced this error.
[](https://i.stack.imgur.com/mWpXa.jpg)
When I press "Copy Error" I am getting this:
```php
TypeError: Cannot read property 'prefix' of null
at https://example.com/wp-i... | So,
I was researching this topic a bit deeper. All answers found on this SE suggested disabling Gutenberg with a plugin. This couldn't be a valid "fix" in my oppinion.
After researching and browsing through the git issues of `WordPress/gutenberg` I've found a pretty easy solution for this problem.
The user `joshuafre... |
325,127 | <p>I recently switched to ssl in order to provide a better and more secure website experience for my users.</p>
<p>I nearly solved all of my mixed content issues, but the mixed content warnings of the Wordpress plugin kk star ratings are still unsolved.</p>
<p>When I open a blog post, I always get the following notif... | [
{
"answer_id": 325226,
"author": "Arvind Singh",
"author_id": 113501,
"author_profile": "https://wordpress.stackexchange.com/users/113501",
"pm_score": 0,
"selected": false,
"text": "<p>Can try replacing all URL from database to https, you can use the plugin \"Search and replace\" or if ... | 2019/01/09 | [
"https://wordpress.stackexchange.com/questions/325127",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/158448/"
] | I recently switched to ssl in order to provide a better and more secure website experience for my users.
I nearly solved all of my mixed content issues, but the mixed content warnings of the Wordpress plugin kk star ratings are still unsolved.
When I open a blog post, I always get the following notifications:
**The ... | I solved it myself. You have to remove the stars in settings / stars. Afterwards the tool recognizes ssl and will load it from a secure version of the website. |
325,136 | <p>I have this custom query:</p>
<pre><code>if (isset($_COOKIE['myCookie']) && $_COOKIE['myCookie'] == $f_r) {
$args = array(
'posts_per_page' => 4,
'nopaging' => false,
'order' => 'ASC',
'orderby' => 'rand',
'tax_query' => array(
array(
'taxonomy... | [
{
"answer_id": 325145,
"author": "ClodClod91",
"author_id": 110442,
"author_profile": "https://wordpress.stackexchange.com/users/110442",
"pm_score": 0,
"selected": false,
"text": "<p>try to use</p>\n\n<p><code>wp_reset_query();\n wp_reset_postdata();</code></p>\n\n<p>As you can see here... | 2019/01/09 | [
"https://wordpress.stackexchange.com/questions/325136",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/157978/"
] | I have this custom query:
```
if (isset($_COOKIE['myCookie']) && $_COOKIE['myCookie'] == $f_r) {
$args = array(
'posts_per_page' => 4,
'nopaging' => false,
'order' => 'ASC',
'orderby' => 'rand',
'tax_query' => array(
array(
'taxonomy' => 'Count',
'field' => ... | If order by RAND is disabled at server level, you can try doing the rand by hand by running the query and get the ids first, then running a new query from the result including x random post ids:
```
$get_all_args = array(
'fields' => 'ids',
'posts_per_page' => 99,
'order' => 'DESC',
'orderby' => '... |
325,151 | <p>From my research there are only two questions I've found around this topic on this site:</p>
<ul>
<li><a href="https://wordpress.stackexchange.com/questions/206907/how-to-change-in-customizer-the-site-identity-tab-required-capabilities">How to change in customizer the “site identity” tab required capabilities</a></... | [
{
"answer_id": 325145,
"author": "ClodClod91",
"author_id": 110442,
"author_profile": "https://wordpress.stackexchange.com/users/110442",
"pm_score": 0,
"selected": false,
"text": "<p>try to use</p>\n\n<p><code>wp_reset_query();\n wp_reset_postdata();</code></p>\n\n<p>As you can see here... | 2019/01/09 | [
"https://wordpress.stackexchange.com/questions/325151",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/25271/"
] | From my research there are only two questions I've found around this topic on this site:
* [How to change in customizer the “site identity” tab required capabilities](https://wordpress.stackexchange.com/questions/206907/how-to-change-in-customizer-the-site-identity-tab-required-capabilities)
* [how to change default i... | If order by RAND is disabled at server level, you can try doing the rand by hand by running the query and get the ids first, then running a new query from the result including x random post ids:
```
$get_all_args = array(
'fields' => 'ids',
'posts_per_page' => 99,
'order' => 'DESC',
'orderby' => '... |
325,160 | <p>I have the Twenty Seventeen theme and I would like to turn off generate SVG (social icons menu) in DOM.</p>
<p><a href="https://i.imgur.com/HZCqOgV.png" rel="nofollow noreferrer">https://i.imgur.com/HZCqOgV.png</a></p>
<p>How can I turn off it? I do not use the social icons, but it is g</p>
<p>In function.php my ... | [
{
"answer_id": 325163,
"author": "mahdi azarm",
"author_id": 94280,
"author_profile": "https://wordpress.stackexchange.com/users/94280",
"pm_score": 1,
"selected": false,
"text": "<p>Create <code>/inc/icon-functions.php</code> file in your child-theme and modify it as you want!</p>\n\n<p... | 2019/01/09 | [
"https://wordpress.stackexchange.com/questions/325160",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/140882/"
] | I have the Twenty Seventeen theme and I would like to turn off generate SVG (social icons menu) in DOM.
<https://i.imgur.com/HZCqOgV.png>
How can I turn off it? I do not use the social icons, but it is g
In function.php my parent theme i see it:
```
require get_parent_theme_file_path( '/inc/icon-functions.php' );
... | If you look at `get_parent_theme_file_path()` it returns `apply_filters( 'parent_theme_file_path', $path, $file );`
You need to add a filter here to override the location to something in your child theme, like so.
```
add_filter('parent_theme_file_path', function($path, $file) {
if ($file !== '/inc/icon-functions.... |
325,183 | <p>Having the exact same problem as <a href="https://wordpress.stackexchange.com/questions/248057/oembed-fails-half-of-the-times-could-i-reload-the-request-on-fail">@Hjalmar</a> on Advanced Custom Fields, but still no fix. Only the URL text displays.</p>
<p><a href="https://i.stack.imgur.com/wzWos.png" rel="nofollow n... | [
{
"answer_id": 329708,
"author": "Roman Nazarkin",
"author_id": 92253,
"author_profile": "https://wordpress.stackexchange.com/users/92253",
"pm_score": 1,
"selected": false,
"text": "<p>Such happens when video is <strong>not publicly accessible</strong>. In my case the video was simply r... | 2019/01/10 | [
"https://wordpress.stackexchange.com/questions/325183",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/150803/"
] | Having the exact same problem as [@Hjalmar](https://wordpress.stackexchange.com/questions/248057/oembed-fails-half-of-the-times-could-i-reload-the-request-on-fail) on Advanced Custom Fields, but still no fix. Only the URL text displays.
[](https://i.stack.... | Such happens when video is **not publicly accessible**. In my case the video was simply removed from YouTube by their author and ACF's oEmbed module was unable to get metadata to properly display video. |
325,252 | <p><strong>Code</strong></p>
<p>Currently, I'm working project to automatically generate all my theme customizer options with simple array.</p>
<pre><code>'nav_font_style' => array(
'default_options' => array(
1 => 'default',),
'css' => " nav#for-mobile ... | [
{
"answer_id": 329708,
"author": "Roman Nazarkin",
"author_id": 92253,
"author_profile": "https://wordpress.stackexchange.com/users/92253",
"pm_score": 1,
"selected": false,
"text": "<p>Such happens when video is <strong>not publicly accessible</strong>. In my case the video was simply r... | 2019/01/10 | [
"https://wordpress.stackexchange.com/questions/325252",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/76309/"
] | **Code**
Currently, I'm working project to automatically generate all my theme customizer options with simple array.
```
'nav_font_style' => array(
'default_options' => array(
1 => 'default',),
'css' => " nav#for-mobile h1 { font-family: $",
'stylesheet_handle' ... | Such happens when video is **not publicly accessible**. In my case the video was simply removed from YouTube by their author and ACF's oEmbed module was unable to get metadata to properly display video. |
325,260 | <p>I want to add an author image for each thumbnail-preview on my homepage.</p>
<p>I tried <code><?php echo get_avatar( get_the_author_meta( 'ID' ), 32 ); ?></code> but it gives me the same image in every thumbnail.</p>
<p>Here's the full code for the thumbnails:</p>
<pre><code> <?php
$recentp_arg... | [
{
"answer_id": 329708,
"author": "Roman Nazarkin",
"author_id": 92253,
"author_profile": "https://wordpress.stackexchange.com/users/92253",
"pm_score": 1,
"selected": false,
"text": "<p>Such happens when video is <strong>not publicly accessible</strong>. In my case the video was simply r... | 2019/01/10 | [
"https://wordpress.stackexchange.com/questions/325260",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/107225/"
] | I want to add an author image for each thumbnail-preview on my homepage.
I tried `<?php echo get_avatar( get_the_author_meta( 'ID' ), 32 ); ?>` but it gives me the same image in every thumbnail.
Here's the full code for the thumbnails:
```
<?php
$recentp_args = array( 'numberposts' => '4' );
$re... | Such happens when video is **not publicly accessible**. In my case the video was simply removed from YouTube by their author and ACF's oEmbed module was unable to get metadata to properly display video. |
325,269 | <p>I am working for a public service website and we really need a text-only version of the website, or a black and white version, for people with special needs.</p>
<p>Is there any plug-in or script that can do this?
Thank you so much!</p>
| [
{
"answer_id": 325270,
"author": "mrben522",
"author_id": 84703,
"author_profile": "https://wordpress.stackexchange.com/users/84703",
"pm_score": 2,
"selected": false,
"text": "<p>Sounds like your actual goal is accessibility. You should check out <a href=\"https://www.w3.org/WAI/standar... | 2019/01/10 | [
"https://wordpress.stackexchange.com/questions/325269",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/147952/"
] | I am working for a public service website and we really need a text-only version of the website, or a black and white version, for people with special needs.
Is there any plug-in or script that can do this?
Thank you so much! | If you wanted to remove all colorful text from your site, you could use a global CSS rule, as in
```
* {color:black !important; background-color:white !important}
```
which should turn all text to black on white background. (The '\*" should apply to all CSS elements.) That wouldn't get rid of images or other things... |
325,271 | <p>I have an ACF-field, that gives an output like this:</p>
<pre><code><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<p><img class="alignnone size-large wp-image-48" src="http://example.org/wp-content/uploads/2019/01/foo-bar.jpg" alt="" width="1024" height="640" /></p>
&... | [
{
"answer_id": 325351,
"author": "Peter HvD",
"author_id": 134918,
"author_profile": "https://wordpress.stackexchange.com/users/134918",
"pm_score": 0,
"selected": false,
"text": "<p>Use <code>the_excerpt</code> filter (see <a href=\"https://developer.wordpress.org/reference/hooks/the_ex... | 2019/01/10 | [
"https://wordpress.stackexchange.com/questions/325271",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/128304/"
] | I have an ACF-field, that gives an output like this:
```
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<p><img class="alignnone size-large wp-image-48" src="http://example.org/wp-content/uploads/2019/01/foo-bar.jpg" alt="" width="1024" height="640" /></p>
<p>Sed lacinia enim a <strong>est aliquet</st... | You can provide your own implementation of `wp_trim_excerpt` which is responsible for trimming and stripping HTML tags (it uses `wp_strip_all_tags`),
By copying the function source code and applying the change that you want (which is keeping the `<p>` and `<strong>` tags (or any additional tags as you wish) and it wi... |
325,303 | <p>My lost password option in the wp login page redirect to woocommerce lost password page.How to set it back to the standard wp lost password option.?I want it to redirect to "wp-login.php?action=lostpassword".
I am using,woocommerce,paid membership pro,buddypress plugins.
I found this <a href="https://wordpress.stack... | [
{
"answer_id": 325304,
"author": "Pratik Patel",
"author_id": 143123,
"author_profile": "https://wordpress.stackexchange.com/users/143123",
"pm_score": 2,
"selected": true,
"text": "<p>Try to put below code into your theme <strong>functions.php</strong> file</p>\n\n<pre><code>remove_filt... | 2019/01/11 | [
"https://wordpress.stackexchange.com/questions/325303",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/158576/"
] | My lost password option in the wp login page redirect to woocommerce lost password page.How to set it back to the standard wp lost password option.?I want it to redirect to "wp-login.php?action=lostpassword".
I am using,woocommerce,paid membership pro,buddypress plugins.
I found this [Lost password link is redirecting ... | Try to put below code into your theme **functions.php** file
```
remove_filter( 'lostpassword_url', 'wc_lostpassword_url', 10 );
```
OR
```
function reset_pass_url() {
$siteURL = get_option('siteurl');
return "{$siteURL}/wp-login.php?action=lostpassword";
}
add_filter( 'lostpassword_url', 'reset_pass_url', ... |
325,361 | <p>My old permalink structure is <code>/index.php/%year%/%monthnum%/%day%/%postname%/</code>.
For example:</p>
<p><code>https://example.com/index.php/2019/01/08/technological-innovation-for-agriculture-sector-in-india/</code></p>
<p>but I want to change to "Post name". For example:</p>
<pre><code>https://example.co... | [
{
"answer_id": 325319,
"author": "Stefano Tombolini",
"author_id": 96268,
"author_profile": "https://wordpress.stackexchange.com/users/96268",
"pm_score": 0,
"selected": false,
"text": "<p>I suggest using BuddyPress user profiles feature, you don't need to enable all BuddyPress features.... | 2019/01/11 | [
"https://wordpress.stackexchange.com/questions/325361",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/142924/"
] | My old permalink structure is `/index.php/%year%/%monthnum%/%day%/%postname%/`.
For example:
`https://example.com/index.php/2019/01/08/technological-innovation-for-agriculture-sector-in-india/`
but I want to change to "Post name". For example:
```
https://example.com/sample-post/
```
also, want to remove `index.p... | I suggest using BuddyPress user profiles feature, you don't need to enable all BuddyPress features.
Gravity Forms can be used to create profile-like fields, but it is not really tied to real WordPress user profiles: <https://www.gravityforms.com/creating-team-member-profiles/> |
325,391 | <p>I am creating a custom field <code>Tracking_ID</code> on Woocommerce, where the admin will enter the tracking ID as value.</p>
<p>How can i get the value of the created custom field and display it inside the <code>customer-completed-order.php</code> </p>
<p>Also (Optional) i want to show the tracking ID field in t... | [
{
"answer_id": 325437,
"author": "Melissa Freeman",
"author_id": 84867,
"author_profile": "https://wordpress.stackexchange.com/users/84867",
"pm_score": 1,
"selected": false,
"text": "<p>The syntax to get your custom field is:</p>\n\n<pre><code>get_post_meta($post_id, $key, $single);\n</... | 2019/01/12 | [
"https://wordpress.stackexchange.com/questions/325391",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/87667/"
] | I am creating a custom field `Tracking_ID` on Woocommerce, where the admin will enter the tracking ID as value.
How can i get the value of the created custom field and display it inside the `customer-completed-order.php`
Also (Optional) i want to show the tracking ID field in the user's `track-order` order page in h... | Based on Melissa's answer, here is what i did and it worked for me.
```
<?php
#Tracking ID
$tracking_id = get_post_meta($order->get_order_number(), 'Tracking_ID', true);
if( ! empty($tracking_id) )
{ ?>
<p> <?php
printf( esc_html__( 'Your tracking number is: %s', 'woocommerce' ), esc_html($tracki... |
325,428 | <p>I have a site where I created a page that takes the gallery images from a post and puts them into a slider. </p>
<p>I used the following code:</p>
<pre><code>// gets the gallery info
$gallery = get_post_gallery( $post->ID, false );
// makes an array of image ids
$ids = explode ( ",", $gallery['ids'] );
</code><... | [
{
"answer_id": 325431,
"author": "birgire",
"author_id": 26350,
"author_profile": "https://wordpress.stackexchange.com/users/26350",
"pm_score": 2,
"selected": false,
"text": "<p>The <code>get_post_gallery()</code> is a wrapper for <code>get_post_galleries()</code> that has an open ticke... | 2019/01/12 | [
"https://wordpress.stackexchange.com/questions/325428",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/120936/"
] | I have a site where I created a page that takes the gallery images from a post and puts them into a slider.
I used the following code:
```
// gets the gallery info
$gallery = get_post_gallery( $post->ID, false );
// makes an array of image ids
$ids = explode ( ",", $gallery['ids'] );
```
Then I inserted the images... | Using birgire's suggestions, I came up with the following solution that is working well with both the old pre-WP 4.x data and the newer posts that have been added under 5.0.
```
// if there is a gallery block do this
if (has_block('gallery', $post->post_content)) {
$post_blocks = parse_blocks($post->post_content)... |
325,429 | <p>I have a website running WP connected to a MySql db, where the latter uses PHP. I did not make the site and have only small experience with WP. This may be a simple question. The WP also uses Elementor. I interact with the db via phpMyAdmin.</p>
<p>I have this page = <a href="http://linket.info/signup/" rel="nofol... | [
{
"answer_id": 325431,
"author": "birgire",
"author_id": 26350,
"author_profile": "https://wordpress.stackexchange.com/users/26350",
"pm_score": 2,
"selected": false,
"text": "<p>The <code>get_post_gallery()</code> is a wrapper for <code>get_post_galleries()</code> that has an open ticke... | 2019/01/12 | [
"https://wordpress.stackexchange.com/questions/325429",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/158888/"
] | I have a website running WP connected to a MySql db, where the latter uses PHP. I did not make the site and have only small experience with WP. This may be a simple question. The WP also uses Elementor. I interact with the db via phpMyAdmin.
I have this page = <http://linket.info/signup/>
It accepts input data that do... | Using birgire's suggestions, I came up with the following solution that is working well with both the old pre-WP 4.x data and the newer posts that have been added under 5.0.
```
// if there is a gallery block do this
if (has_block('gallery', $post->post_content)) {
$post_blocks = parse_blocks($post->post_content)... |
325,469 | <p>In my index page there are two slider one is working fine but the second one is giving some problems.</p>
<h2>FIRST ONE</h2>
<pre><code><?php
global $post;
$i=0;
$args = array('post_per_page' => -1, 'post_type' => 'slider-items', 'page' => $paged, 'order' => 'ASC');
$myposts = get_posts($args);
fo... | [
{
"answer_id": 325431,
"author": "birgire",
"author_id": 26350,
"author_profile": "https://wordpress.stackexchange.com/users/26350",
"pm_score": 2,
"selected": false,
"text": "<p>The <code>get_post_gallery()</code> is a wrapper for <code>get_post_galleries()</code> that has an open ticke... | 2019/01/13 | [
"https://wordpress.stackexchange.com/questions/325469",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/158922/"
] | In my index page there are two slider one is working fine but the second one is giving some problems.
FIRST ONE
---------
```
<?php
global $post;
$i=0;
$args = array('post_per_page' => -1, 'post_type' => 'slider-items', 'page' => $paged, 'order' => 'ASC');
$myposts = get_posts($args);
foreach( $myposts as $post ) :... | Using birgire's suggestions, I came up with the following solution that is working well with both the old pre-WP 4.x data and the newer posts that have been added under 5.0.
```
// if there is a gallery block do this
if (has_block('gallery', $post->post_content)) {
$post_blocks = parse_blocks($post->post_content)... |
325,489 | <p>In a template, I have a need to <code>include_once</code> an external PHP (an <code>include.php</code>) that contains functions that I need to use inside the template.</p>
<p>Included in those functions are CSS styles and an external JS script.</p>
<p>The CSS is inside a function in the include.php. And the JS scr... | [
{
"answer_id": 325490,
"author": "Tom J Nowell",
"author_id": 736,
"author_profile": "https://wordpress.stackexchange.com/users/736",
"pm_score": 1,
"selected": false,
"text": "<p>Including PHP files inside actions isn't recommended, and is considered <strong>highly unusual</strong>. If ... | 2019/01/13 | [
"https://wordpress.stackexchange.com/questions/325489",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/29416/"
] | In a template, I have a need to `include_once` an external PHP (an `include.php`) that contains functions that I need to use inside the template.
Included in those functions are CSS styles and an external JS script.
The CSS is inside a function in the include.php. And the JS script also needs to be in the area.
So I... | After much experimentation, and limited help from the googles, I figured how to do an '`include`' of an external functions file inside a Template.
The key is to use the `get_template_part` in your Template at the beginning (after the template header). The file specified in that function must be in your Theme's root fo... |
325,536 | <p>I have 2 categories in my cutom post type:
Cat 1
Cat 2</p>
<p>I wish display a random category from this post type. I made this and it works:</p>
<pre><code>function categorie(){
$global;
$args = array('type' => 'carte', 'taxonomy' => 'carte-category', 'parent' => 0);
$categories = ge... | [
{
"answer_id": 325538,
"author": "wpdev",
"author_id": 133897,
"author_profile": "https://wordpress.stackexchange.com/users/133897",
"pm_score": -1,
"selected": false,
"text": "<p>Inser this inside foreach loop:</p>\n\n<pre><code>$args_query = array(\n 'order' => 'DESC',\n... | 2019/01/14 | [
"https://wordpress.stackexchange.com/questions/325536",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/158978/"
] | I have 2 categories in my cutom post type:
Cat 1
Cat 2
I wish display a random category from this post type. I made this and it works:
```
function categorie(){
$global;
$args = array('type' => 'carte', 'taxonomy' => 'carte-category', 'parent' => 0);
$categories = get_categories($args);
shuff... | All you need to do is to add another query in your code:
```
function categorie_shortcode_callback() {
$html = '';
$categories = get_categories( array(
// 'type' => 'carte', <- THERE IS NO ATTRIBUTE CALLED type FOR get_categories, SO REMOVE THAT
'taxonomy' => 'carte-category',
'pa... |
325,563 | <p>I created a page (<a href="https://padigital.org/rights/" rel="nofollow noreferrer">https://padigital.org/rights/</a>) to test something, then deleted it. It still appears in Google searches. However, it no longer appears in the Admin Dashboard, so I'm unable to delete/make it private. How do I find it to delete it ... | [
{
"answer_id": 325566,
"author": "RiddleMeThis",
"author_id": 86845,
"author_profile": "https://wordpress.stackexchange.com/users/86845",
"pm_score": 1,
"selected": false,
"text": "<p>Since that page has already been indexed you can do a couple things.</p>\n\n<p><strong>1</strong> - Add ... | 2019/01/14 | [
"https://wordpress.stackexchange.com/questions/325563",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/159001/"
] | I created a page (<https://padigital.org/rights/>) to test something, then deleted it. It still appears in Google searches. However, it no longer appears in the Admin Dashboard, so I'm unable to delete/make it private. How do I find it to delete it again? | Since that page has already been indexed you can do a couple things.
**1** - Add a rule in your .htaccess file that tells search engines not to index the page
```
User-agent: *
Disallow: /rights
```
**2** - Use Google's Remove URLs Tool. The Remove URLs tool enables you to temporarily block pages from Google Search... |
325,569 | <p>I want to create on my blog a category loop with the featured image.
But i don't know how i do that technical.</p>
<p>You should only see a list of categories and click on them to get the category site. It's like a article loop only with categories.</p>
<p>Thank you for any help :)</p>
<p><a href="https://i.stack... | [
{
"answer_id": 325583,
"author": "Krzysiek Dróżdż",
"author_id": 34172,
"author_profile": "https://wordpress.stackexchange.com/users/34172",
"pm_score": 1,
"selected": false,
"text": "<p>Well, in WP the word \"loop\" is mainly related to posts. It's easier to say that you want to display... | 2019/01/14 | [
"https://wordpress.stackexchange.com/questions/325569",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/158400/"
] | I want to create on my blog a category loop with the featured image.
But i don't know how i do that technical.
You should only see a list of categories and click on them to get the category site. It's like a article loop only with categories.
Thank you for any help :)
[ function and display them.
```
<?php
$categories = get_categories( array(
... |
325,574 | <p>The following code should redirect the user to a specific page if they have the manage_woocommerce capability or higher - but it doesn't and just goes to the main dashboard.</p>
<pre><code> add_filter( 'login_redirect', array( $this, 'login_redirect' ), 10, 3 );
public function login_redirect( $redirect_to, ... | [
{
"answer_id": 325587,
"author": "Krzysiek Dróżdż",
"author_id": 34172,
"author_profile": "https://wordpress.stackexchange.com/users/34172",
"pm_score": 3,
"selected": true,
"text": "<p>OK, it wasn't easy to catch, but... There is one major problem in your code...</p>\n\n<p>First check y... | 2019/01/14 | [
"https://wordpress.stackexchange.com/questions/325574",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/75779/"
] | The following code should redirect the user to a specific page if they have the manage\_woocommerce capability or higher - but it doesn't and just goes to the main dashboard.
```
add_filter( 'login_redirect', array( $this, 'login_redirect' ), 10, 3 );
public function login_redirect( $redirect_to, $request, $us... | OK, it wasn't easy to catch, but... There is one major problem in your code...
First check you make is:
```
if ( is_user_logged_in() == 1 ) {
```
And `is_user_logged_in()` is based on global `$current_user` variable. But... As you can read in [`login_redirect` hook docs](https://codex.wordpress.org/Plugin_API/Filte... |
325,622 | <p>How can I put my own code in a wordpress page? </p>
<p>This happens when I tried to
<a href="https://i.stack.imgur.com/27KOk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/27KOk.png" alt="pic1"></a></p>
<p><a href="https://i.stack.imgur.com/yZOyA.png" rel="nofollow noreferrer"><img src="https:/... | [
{
"answer_id": 325587,
"author": "Krzysiek Dróżdż",
"author_id": 34172,
"author_profile": "https://wordpress.stackexchange.com/users/34172",
"pm_score": 3,
"selected": true,
"text": "<p>OK, it wasn't easy to catch, but... There is one major problem in your code...</p>\n\n<p>First check y... | 2019/01/15 | [
"https://wordpress.stackexchange.com/questions/325622",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/159037/"
] | How can I put my own code in a wordpress page?
This happens when I tried to
[](https://i.stack.imgur.com/27KOk.png)
[](https://i.stack.imgur.com/yZOyA.png) | OK, it wasn't easy to catch, but... There is one major problem in your code...
First check you make is:
```
if ( is_user_logged_in() == 1 ) {
```
And `is_user_logged_in()` is based on global `$current_user` variable. But... As you can read in [`login_redirect` hook docs](https://codex.wordpress.org/Plugin_API/Filte... |
325,663 | <p>I'm trying to make some pretty URLs that show content from a category page. An example would be this: <a href="https://example.com/resources/white-paper" rel="nofollow noreferrer">https://example.com/resources/white-paper</a> (not a real WP page) would show content from <a href="https://example.com/resources/?type=w... | [
{
"answer_id": 325671,
"author": "WebElaine",
"author_id": 102815,
"author_profile": "https://wordpress.stackexchange.com/users/102815",
"pm_score": -1,
"selected": false,
"text": "<p>As long as you're only dealing with one CPT, when you register your post type, make sure to set <code>ha... | 2019/01/15 | [
"https://wordpress.stackexchange.com/questions/325663",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/28497/"
] | I'm trying to make some pretty URLs that show content from a category page. An example would be this: <https://example.com/resources/white-paper> (not a real WP page) would show content from <https://example.com/resources/?type=white-paper>. /resources is an archive page of a custom post type, and the archive page temp... | Use [`add_rewrite_rule()`](https://codex.wordpress.org/Rewrite_API/add_rewrite_rule).
```
function wpse325663_rewrite_resource_type() {
add_rewrite_rule('^resources\/(.+)/?', 'resources/?type=$matches[1]', 'top');
}
add_action('init', 'wpse325663_rewrite_resource_type');
```
An important note from [the codex](ht... |
325,670 | <p>Any ideal way how to change Gutenberg's categories checkboxes to radio inputs? I have tried using this plugin: <a href="https://wordpress.org/plugins/categories-metabox-enhanced/" rel="nofollow noreferrer">Categories Metabox Enhanced</a>. </p>
<p>But it doesn't work fully well with Gutenberg, meaning my conditions ... | [
{
"answer_id": 328707,
"author": "leymannx",
"author_id": 30597,
"author_profile": "https://wordpress.stackexchange.com/users/30597",
"pm_score": -1,
"selected": false,
"text": "<p>Yes, <a href=\"https://wordpress.org/plugins/categories-metabox-enhanced/\" rel=\"nofollow noreferrer\">Cat... | 2019/01/15 | [
"https://wordpress.stackexchange.com/questions/325670",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/129306/"
] | Any ideal way how to change Gutenberg's categories checkboxes to radio inputs? I have tried using this plugin: [Categories Metabox Enhanced](https://wordpress.org/plugins/categories-metabox-enhanced/).
But it doesn't work fully well with Gutenberg, meaning my conditions to show some field when a term is checked doesn... | Fortunately there is a hook that we can use to customize what component is used to render the taxonomy panels called `editor.PostTaxonomyType`.
Gutenberg renders taxonomy panels with a component called `PostTaxonomies`, which really just checks whether the taxonomy is heirarchical or not, and passes the props along to... |
325,672 | <p>I have created a search using WP_Query, it seems like this query is looking for the queried term in title AND tags. </p>
<p>Is there a way to have this search the title OR tags?</p>
<pre><code>$s = $request['s'];
$tags = str_replace(' ', '-', strtolower($request['s']));
$paged = $request['page'];
$posts_per_page ... | [
{
"answer_id": 326512,
"author": "Community",
"author_id": -1,
"author_profile": "https://wordpress.stackexchange.com/users/-1",
"pm_score": -1,
"selected": false,
"text": "<p>You just need to add </p>\n\n<pre><code> 'relation' => 'OR'\n</code></pre>\n\n<p>in your Query arguments.\nad... | 2019/01/15 | [
"https://wordpress.stackexchange.com/questions/325672",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/13679/"
] | I have created a search using WP\_Query, it seems like this query is looking for the queried term in title AND tags.
Is there a way to have this search the title OR tags?
```
$s = $request['s'];
$tags = str_replace(' ', '-', strtolower($request['s']));
$paged = $request['page'];
$posts_per_page = $request['per_page... | Please use below code to show posts in texonomy and titles
```
$s = $request['s'];
$tags = str_replace(' ', '-', strtolower($request['s']));
$q1 = get_posts(array(
'fields' => 'id',
'post_type' => 'post',
'post_status' => 'publish',
'posts_per_page' => -1,
's' => $s
));
$q2... |
325,690 | <p>When I try to save my site in the Gutenberg Editor it just says "Updating failed".</p>
<p>How to fix that?</p>
| [
{
"answer_id": 325691,
"author": "Noah Krasser",
"author_id": 159080,
"author_profile": "https://wordpress.stackexchange.com/users/159080",
"pm_score": 1,
"selected": false,
"text": "<p>There are many reasons this error can occur. Those two were the most frequent for me:</p>\n\n<h2>Sessi... | 2019/01/15 | [
"https://wordpress.stackexchange.com/questions/325690",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/159080/"
] | When I try to save my site in the Gutenberg Editor it just says "Updating failed".
How to fix that? | There are many reasons this error can occur. Those two were the most frequent for me:
Session-Cookie
--------------
Open the Javascript Console by pressing F12 and click on the tab "Console". If you see some error message that goes something like `cookie_nonce` it's a session cookie problem.
The problem solves by ju... |
325,717 | <p>I am new to wordpress and I just install version 5.0.3and I installed Consult theme.</p>
<p>At the button of page,I am getting this message:</p>
<pre><code>The-Consult By Themeruler.
</code></pre>
<p>How can I remove it from the pages?</p>
| [
{
"answer_id": 325794,
"author": "Loren Rosen",
"author_id": 158993,
"author_profile": "https://wordpress.stackexchange.com/users/158993",
"pm_score": 1,
"selected": false,
"text": "<p>There probably isn't a simple button you can push (unless there's a special one the theme developer cre... | 2019/01/15 | [
"https://wordpress.stackexchange.com/questions/325717",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/159103/"
] | I am new to wordpress and I just install version 5.0.3and I installed Consult theme.
At the button of page,I am getting this message:
```
The-Consult By Themeruler.
```
How can I remove it from the pages? | There probably isn't a simple button you can push (unless there's a special one the theme developer created), but it can most likely be done via some basic theme tweaking.
First, make a child theme. There are lots of tutorials about how to do that.
Second, modify the child theme. Two options for this:
* hide the me... |
325,720 | <p>I tried everything I found online. The backend appears, including dynamic segments (withSelect, etc). But the simplest 'render-callback' doesn't appear on the frontend.</p>
<p>plugin.php
<pre><code>/**
* Plugin Name: My Dynamic Block
*/
function my_plugin_render_dynamic_block( ) {
return '<h1>Sam... | [
{
"answer_id": 326236,
"author": "Ashiquzzaman Kiron",
"author_id": 78505,
"author_profile": "https://wordpress.stackexchange.com/users/78505",
"pm_score": -1,
"selected": false,
"text": "<p>Even if you do manage to render frontend with null return, On the next page reload you'll get blo... | 2019/01/15 | [
"https://wordpress.stackexchange.com/questions/325720",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/158827/"
] | I tried everything I found online. The backend appears, including dynamic segments (withSelect, etc). But the simplest 'render-callback' doesn't appear on the frontend.
plugin.php
```
/**
* Plugin Name: My Dynamic Block
*/
function my_plugin_render_dynamic_block( ) {
return '<h1>Sample Block</h1>';
}
function... | Even if you do manage to render frontend with null return, On the next page reload you'll get block validation error. Because your html structure on edit function will not be matching up with save function. So
Instead of
```
save() {
return null;
},
```
Try
```
save() {
return (
... |
325,724 | <p>With WP 5.0 you can now enable full width blocks in the editor by adding this to your theme:
<code>add_theme_support( 'align-wide' );</code></p>
<p>However, if you are using a custom theme you have to add <em>your own</em> CSS to make that work, as discussed in this <a href="https://github.com/WordPress/gutenberg/i... | [
{
"answer_id": 327701,
"author": "NickFMC",
"author_id": 56566,
"author_profile": "https://wordpress.stackexchange.com/users/56566",
"pm_score": 3,
"selected": true,
"text": "<p>After banging my head over that horizontal scroll bar issue, I think going the other way and adding a max widt... | 2019/01/16 | [
"https://wordpress.stackexchange.com/questions/325724",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/17461/"
] | With WP 5.0 you can now enable full width blocks in the editor by adding this to your theme:
`add_theme_support( 'align-wide' );`
However, if you are using a custom theme you have to add *your own* CSS to make that work, as discussed in this [Gutenberg issue](https://github.com/WordPress/gutenberg/issues/8289). There ... | After banging my head over that horizontal scroll bar issue, I think going the other way and adding a max width to blocks without the alignfull classes. If you just remove your page templates wrapper and assume it as 100%. Here is a pen with the WP markup as closely emulated as I could <https://codepen.io/nickfmc/pen/v... |
325,803 | <p>I've been working on a wordpress site (geniedrinks.co.uk) using the Jevelin theme. Last night, I deactivated a plugin called WP Bakery Page Builder (js_composer) which immediately resulted in HTTP error 500 across all pages - I can't even access my wp-admin page. </p>
<p>I have a feeling reactivating the plugin mig... | [
{
"answer_id": 325808,
"author": "RiddleMeThis",
"author_id": 86845,
"author_profile": "https://wordpress.stackexchange.com/users/86845",
"pm_score": 3,
"selected": true,
"text": "<p>You can do this by editing the database via PhpMyAdmin.</p>\n\n<p>Go to your database's <strong>Options t... | 2019/01/16 | [
"https://wordpress.stackexchange.com/questions/325803",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/159173/"
] | I've been working on a wordpress site (geniedrinks.co.uk) using the Jevelin theme. Last night, I deactivated a plugin called WP Bakery Page Builder (js\_composer) which immediately resulted in HTTP error 500 across all pages - I can't even access my wp-admin page.
I have a feeling reactivating the plugin might correc... | You can do this by editing the database via PhpMyAdmin.
Go to your database's **Options table** and find a row called **active\_plugins**.
You should see something like this...
```
a:10:{
i:0;s:49:"1and1-wordpress-wizard/1and1-wordpress-wizard.php";
i:1;s:29:"acf-repeater/acf-repeater.php";
i:2;s:30:"adv... |
325,849 | <p>On a site that has many different image sizes each time an image is uploaded all the different thumbnail sizes are created causing a fair bit of bloat.
What would be the best way of optimising this process?</p>
<p>With a custom post type of <strong>‘product’</strong>, where the different product type images have sl... | [
{
"answer_id": 325808,
"author": "RiddleMeThis",
"author_id": 86845,
"author_profile": "https://wordpress.stackexchange.com/users/86845",
"pm_score": 3,
"selected": true,
"text": "<p>You can do this by editing the database via PhpMyAdmin.</p>\n\n<p>Go to your database's <strong>Options t... | 2019/01/17 | [
"https://wordpress.stackexchange.com/questions/325849",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/137417/"
] | On a site that has many different image sizes each time an image is uploaded all the different thumbnail sizes are created causing a fair bit of bloat.
What would be the best way of optimising this process?
With a custom post type of **‘product’**, where the different product type images have slightly different aspect... | You can do this by editing the database via PhpMyAdmin.
Go to your database's **Options table** and find a row called **active\_plugins**.
You should see something like this...
```
a:10:{
i:0;s:49:"1and1-wordpress-wizard/1and1-wordpress-wizard.php";
i:1;s:29:"acf-repeater/acf-repeater.php";
i:2;s:30:"adv... |
325,855 | <p><strong>EDIT</strong> <em>the title of this question was "Does anyone know if Jetpack is caching pages/content" but has been changed following the thread.</em></p>
<p>I just updated a plugin I made.
Among others, it does filter the content of a page using <code>the_content</code> hook.</p>
<p>But I noticed that it... | [
{
"answer_id": 325808,
"author": "RiddleMeThis",
"author_id": 86845,
"author_profile": "https://wordpress.stackexchange.com/users/86845",
"pm_score": 3,
"selected": true,
"text": "<p>You can do this by editing the database via PhpMyAdmin.</p>\n\n<p>Go to your database's <strong>Options t... | 2019/01/17 | [
"https://wordpress.stackexchange.com/questions/325855",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/70449/"
] | **EDIT** *the title of this question was "Does anyone know if Jetpack is caching pages/content" but has been changed following the thread.*
I just updated a plugin I made.
Among others, it does filter the content of a page using `the_content` hook.
But I noticed that it does not behaves like it should once I pushed t... | You can do this by editing the database via PhpMyAdmin.
Go to your database's **Options table** and find a row called **active\_plugins**.
You should see something like this...
```
a:10:{
i:0;s:49:"1and1-wordpress-wizard/1and1-wordpress-wizard.php";
i:1;s:29:"acf-repeater/acf-repeater.php";
i:2;s:30:"adv... |
325,871 | <p>Hi I used the Edin theme to build a wordpress website. I modified a big part of the CSS at the CSS editor, without having a clue what a child theme is. What should I do now? Create a child theme and delete the additional CSS of the parent theme? Any ideas?</p>
<p>Thank you very much!! </p>
| [
{
"answer_id": 325872,
"author": "Nour Edin Al-Habal",
"author_id": 97257,
"author_profile": "https://wordpress.stackexchange.com/users/97257",
"pm_score": -1,
"selected": false,
"text": "<p>If you've changed the original theme files, create a child theme and move your changes to the new... | 2019/01/17 | [
"https://wordpress.stackexchange.com/questions/325871",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/159229/"
] | Hi I used the Edin theme to build a wordpress website. I modified a big part of the CSS at the CSS editor, without having a clue what a child theme is. What should I do now? Create a child theme and delete the additional CSS of the parent theme? Any ideas?
Thank you very much!! | As [Jacob Peattie](https://wordpress.stackexchange.com/users/39152/jacob-peattie) mentioned, you've made custom CSS changes in a way that does not impact your theme. To expand a bit more, this is the *only* place you can make changes that will persist through a theme update or change. All other customizations get wiped... |
325,873 | <p>I created a field to enter whatsapp number in the front of a site in wordpress, since the back is simple, but I need to change it from the front section for the users
<a href="https://i.stack.imgur.com/7sGZZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7sGZZ.png" alt="enter image description he... | [
{
"answer_id": 325872,
"author": "Nour Edin Al-Habal",
"author_id": 97257,
"author_profile": "https://wordpress.stackexchange.com/users/97257",
"pm_score": -1,
"selected": false,
"text": "<p>If you've changed the original theme files, create a child theme and move your changes to the new... | 2019/01/17 | [
"https://wordpress.stackexchange.com/questions/325873",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/129154/"
] | I created a field to enter whatsapp number in the front of a site in wordpress, since the back is simple, but I need to change it from the front section for the users
[](https://i.stack.imgur.com/7sGZZ.png)
I have already placed an input where I show ... | As [Jacob Peattie](https://wordpress.stackexchange.com/users/39152/jacob-peattie) mentioned, you've made custom CSS changes in a way that does not impact your theme. To expand a bit more, this is the *only* place you can make changes that will persist through a theme update or change. All other customizations get wiped... |
325,875 | <p>I've inherited a wordpress website I need to maintain. Despite having upgraded it to the latest version (5.03), and having changed the theme, there seems to be some customisations which survived. These seem to be CSS related, affecting the general page template, as well as a specific plug-in. I would like to remove ... | [
{
"answer_id": 325879,
"author": "WebElaine",
"author_id": 102815,
"author_profile": "https://wordpress.stackexchange.com/users/102815",
"pm_score": 3,
"selected": true,
"text": "<p>When you inspect elements on the affected pages, it should tell you which CSS file is enforcing the rule. ... | 2019/01/17 | [
"https://wordpress.stackexchange.com/questions/325875",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/68023/"
] | I've inherited a wordpress website I need to maintain. Despite having upgraded it to the latest version (5.03), and having changed the theme, there seems to be some customisations which survived. These seem to be CSS related, affecting the general page template, as well as a specific plug-in. I would like to remove the... | When you inspect elements on the affected pages, it should tell you which CSS file is enforcing the rule. If the file is somewhere inside `/wp-content/plugins/` then a plugin is adding them and you can either disable that plugin or see whether they have properly enqueued the CSS. If inside the plugin the style is added... |
325,886 | <p>I import image to wordpress via <code>wp_insert_attachment</code>. </p>
<p>On frontend wordpress media library still don't know that image is imported. I need a way to update attachments in media library without refreshing page.</p>
<p>I found partial solution:</p>
<pre><code>wp.media.frame.on('open', function() ... | [
{
"answer_id": 325890,
"author": "Nour Edin Al-Habal",
"author_id": 97257,
"author_profile": "https://wordpress.stackexchange.com/users/97257",
"pm_score": 0,
"selected": false,
"text": "<p>This depends on how you use <code>wp_insert_attachment()</code>. Here is a full example copied fro... | 2019/01/17 | [
"https://wordpress.stackexchange.com/questions/325886",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/107666/"
] | I import image to wordpress via `wp_insert_attachment`.
On frontend wordpress media library still don't know that image is imported. I need a way to update attachments in media library without refreshing page.
I found partial solution:
```
wp.media.frame.on('open', function() {
if (wp.media.frame.content.get() ... | edit: ok after working on this for the last hour ive finally found a solution that works without affecting uploading and without messing with ignore or reset
```
wp.media.frame.on('open', function() {
if (wp.media.frame.content.get() !== null) {
// this forces a refresh of the content
wp.... |
325,937 | <p>I am in the process of rescuing the content from a WordPress site with a bloated/damaged database. Everything has gone according to plan except for the comments. I can see that the 4000+ comments are indeed in the database's <code>wp_comments</code> table, and I verified that the IDs of the associated posts are corr... | [
{
"answer_id": 325890,
"author": "Nour Edin Al-Habal",
"author_id": 97257,
"author_profile": "https://wordpress.stackexchange.com/users/97257",
"pm_score": 0,
"selected": false,
"text": "<p>This depends on how you use <code>wp_insert_attachment()</code>. Here is a full example copied fro... | 2019/01/18 | [
"https://wordpress.stackexchange.com/questions/325937",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/159268/"
] | I am in the process of rescuing the content from a WordPress site with a bloated/damaged database. Everything has gone according to plan except for the comments. I can see that the 4000+ comments are indeed in the database's `wp_comments` table, and I verified that the IDs of the associated posts are correct, but none ... | edit: ok after working on this for the last hour ive finally found a solution that works without affecting uploading and without messing with ignore or reset
```
wp.media.frame.on('open', function() {
if (wp.media.frame.content.get() !== null) {
// this forces a refresh of the content
wp.... |
325,938 | <p>.htaccess:</p>
<pre><code><IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wp_test/
RewriteRule ^index\.php$ - [L]
RewriteRule ^the_image$ wp-content/uploads/2019/01/banner\.jpg [L]
RewriteRule ^the_page$ sample-page [L]
</IfModule>
</code></pre>
<p>When I go to <code>example.com/the_image</code... | [
{
"answer_id": 325890,
"author": "Nour Edin Al-Habal",
"author_id": 97257,
"author_profile": "https://wordpress.stackexchange.com/users/97257",
"pm_score": 0,
"selected": false,
"text": "<p>This depends on how you use <code>wp_insert_attachment()</code>. Here is a full example copied fro... | 2019/01/18 | [
"https://wordpress.stackexchange.com/questions/325938",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/154532/"
] | .htaccess:
```
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wp_test/
RewriteRule ^index\.php$ - [L]
RewriteRule ^the_image$ wp-content/uploads/2019/01/banner\.jpg [L]
RewriteRule ^the_page$ sample-page [L]
</IfModule>
```
When I go to `example.com/the_image` it shows the correct image. However, if I go to... | edit: ok after working on this for the last hour ive finally found a solution that works without affecting uploading and without messing with ignore or reset
```
wp.media.frame.on('open', function() {
if (wp.media.frame.content.get() !== null) {
// this forces a refresh of the content
wp.... |
325,943 | <p>Adding images to a post with the block editor:</p>
<p><a href="https://i.stack.imgur.com/HxXQ7.png" rel="noreferrer"><img src="https://i.stack.imgur.com/HxXQ7.png" alt="enter image description here"></a></p>
<p>produces the code figure of:</p>
<pre><code><figure class="wp-block-image">
<img src="http... | [
{
"answer_id": 326009,
"author": "user9447",
"author_id": 25271,
"author_profile": "https://wordpress.stackexchange.com/users/25271",
"pm_score": 2,
"selected": false,
"text": "<p>The following answer is a solution for Bootstrap 4 and centering images in a <code><figure></code> tag... | 2019/01/18 | [
"https://wordpress.stackexchange.com/questions/325943",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/25271/"
] | Adding images to a post with the block editor:
[](https://i.stack.imgur.com/HxXQ7.png)
produces the code figure of:
```
<figure class="wp-block-image">
<img src="http://localhost:8888/time.png" alt="alt text" class="wp-image-1391"/>
<figcapt... | After some digging and trial/error I have came up with a couple solutions. I was looking for a "Gutenberg" solution so I could avoid using `str_replace`.
First, we need to enqueue our JS and include the wp.blocks package
```
// Add to functions.php
function gutenberg_enqueue() {
wp_enqueue_script(
'mygut... |
325,956 | <p>I have a code that displays results for search but, I need it to include the count
not just keyword searched</p>
<pre><code><h1 class="font-thin h2 m-b">
<?php
printf( esc_html__( 'Search Results for: %s', 'musik' ), '<span class="font-bold">' . get_search_query() . '</span>' );
?>
</h... | [
{
"answer_id": 325957,
"author": "Mohsin Ghouri",
"author_id": 159253,
"author_profile": "https://wordpress.stackexchange.com/users/159253",
"pm_score": 1,
"selected": false,
"text": "<p>If you are in the search results template then you can find out the count by using the below code.</p... | 2019/01/18 | [
"https://wordpress.stackexchange.com/questions/325956",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/159276/"
] | I have a code that displays results for search but, I need it to include the count
not just keyword searched
```
<h1 class="font-thin h2 m-b">
<?php
printf( esc_html__( 'Search Results for: %s', 'musik' ), '<span class="font-bold">' . get_search_query() . '</span>' );
?>
</h1>
``` | If you are in the search results template then you can find out the count by using the below code.
```
global $wp_query;
$count = $wp_query->found_posts
```
variable `$count` contains the count of post against the search. |
326,005 | <p>the answer to this one will probably be obvious to many of you, but I recently decided to make a website for my girlfriend and expand my knowledge while doing that. So here is my dilemma:</p>
<p>I am using the Blossom Mommy Blog theme, which is a child of the Blossom Feminine theme.</p>
<p>Below a single post page... | [
{
"answer_id": 325957,
"author": "Mohsin Ghouri",
"author_id": 159253,
"author_profile": "https://wordpress.stackexchange.com/users/159253",
"pm_score": 1,
"selected": false,
"text": "<p>If you are in the search results template then you can find out the count by using the below code.</p... | 2019/01/18 | [
"https://wordpress.stackexchange.com/questions/326005",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/159310/"
] | the answer to this one will probably be obvious to many of you, but I recently decided to make a website for my girlfriend and expand my knowledge while doing that. So here is my dilemma:
I am using the Blossom Mommy Blog theme, which is a child of the Blossom Feminine theme.
Below a single post page, there is a prev... | If you are in the search results template then you can find out the count by using the below code.
```
global $wp_query;
$count = $wp_query->found_posts
```
variable `$count` contains the count of post against the search. |
326,013 | <p>I'm loading some third party CSS with the help of wp_enqueue_style. I would like this CSS to be loaded in the footer, so it does not block rendering of the page. This would be fine, since this CSS is related to some chat functionality which is loaded on the page right away anyway. For JS, there is an option for addi... | [
{
"answer_id": 326019,
"author": "admcfajn",
"author_id": 123674,
"author_profile": "https://wordpress.stackexchange.com/users/123674",
"pm_score": 3,
"selected": true,
"text": "<p>Yes, technically you can. But you shouldn't load css in the footer, css links outside of the <code><head... | 2019/01/18 | [
"https://wordpress.stackexchange.com/questions/326013",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/5079/"
] | I'm loading some third party CSS with the help of wp\_enqueue\_style. I would like this CSS to be loaded in the footer, so it does not block rendering of the page. This would be fine, since this CSS is related to some chat functionality which is loaded on the page right away anyway. For JS, there is an option for addin... | Yes, technically you can. But you shouldn't load css in the footer, css links outside of the `<head>` are considered invalid.
A better technique would be to add the css-links to the dom with javaScript. You may even want to split out the css so that critical portions are loaded inline (so you avoid a [FOUC](https://en... |
326,055 | <p>I'm interested in creating a filter for pages with password protection and that have a certain category. I've placed this code in my theme's child folder in functions.php since I didn't want to edit the wp-includes files.</p>
<pre><code>/**
* Retrieve v1-i1 protected post password form content.
*
* @since 1.0.0
... | [
{
"answer_id": 326019,
"author": "admcfajn",
"author_id": 123674,
"author_profile": "https://wordpress.stackexchange.com/users/123674",
"pm_score": 3,
"selected": true,
"text": "<p>Yes, technically you can. But you shouldn't load css in the footer, css links outside of the <code><head... | 2019/01/19 | [
"https://wordpress.stackexchange.com/questions/326055",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/159342/"
] | I'm interested in creating a filter for pages with password protection and that have a certain category. I've placed this code in my theme's child folder in functions.php since I didn't want to edit the wp-includes files.
```
/**
* Retrieve v1-i1 protected post password form content.
*
* @since 1.0.0
*
* @param i... | Yes, technically you can. But you shouldn't load css in the footer, css links outside of the `<head>` are considered invalid.
A better technique would be to add the css-links to the dom with javaScript. You may even want to split out the css so that critical portions are loaded inline (so you avoid a [FOUC](https://en... |
326,066 | <p>I did a small adjustment in the 'custom css' in my theme settings, and now I broke my theme. Whenever I select a page as the home page, it says 'Nothing found'. Whenever I visit a page thats not a home page, it works perfectly fine. </p>
<p>Been looking for hours now. Any help appreciated. </p>
<p>Edit: The change... | [
{
"answer_id": 326019,
"author": "admcfajn",
"author_id": 123674,
"author_profile": "https://wordpress.stackexchange.com/users/123674",
"pm_score": 3,
"selected": true,
"text": "<p>Yes, technically you can. But you shouldn't load css in the footer, css links outside of the <code><head... | 2019/01/19 | [
"https://wordpress.stackexchange.com/questions/326066",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/159369/"
] | I did a small adjustment in the 'custom css' in my theme settings, and now I broke my theme. Whenever I select a page as the home page, it says 'Nothing found'. Whenever I visit a page thats not a home page, it works perfectly fine.
Been looking for hours now. Any help appreciated.
Edit: The change in the CSS I mad... | Yes, technically you can. But you shouldn't load css in the footer, css links outside of the `<head>` are considered invalid.
A better technique would be to add the css-links to the dom with javaScript. You may even want to split out the css so that critical portions are loaded inline (so you avoid a [FOUC](https://en... |
326,088 | <p>Here is a test fiddle: my fiddle: <a href="https://jsfiddle.net/blogob/qtou84Lj/23/" rel="nofollow noreferrer">https://jsfiddle.net/blogob/qtou84Lj/23/</a></p>
<p>I'm trying to build a full width map in a wordpress site with leaflet.</p>
<p>My goal is to dsplay all post with markers on the map. When i click on the... | [
{
"answer_id": 326019,
"author": "admcfajn",
"author_id": 123674,
"author_profile": "https://wordpress.stackexchange.com/users/123674",
"pm_score": 3,
"selected": true,
"text": "<p>Yes, technically you can. But you shouldn't load css in the footer, css links outside of the <code><head... | 2019/01/19 | [
"https://wordpress.stackexchange.com/questions/326088",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/159378/"
] | Here is a test fiddle: my fiddle: <https://jsfiddle.net/blogob/qtou84Lj/23/>
I'm trying to build a full width map in a wordpress site with leaflet.
My goal is to dsplay all post with markers on the map. When i click on the marker, a sidebar appear with the corresponding content in it. It's working.
But i have a prob... | Yes, technically you can. But you shouldn't load css in the footer, css links outside of the `<head>` are considered invalid.
A better technique would be to add the css-links to the dom with javaScript. You may even want to split out the css so that critical portions are loaded inline (so you avoid a [FOUC](https://en... |
326,109 | <p>I Need to build an interface with a filter set (a list of checkboxes) that the user can check and click 'filter' to search with in 1 custom post-type for posts with matching terms (there are 3 custom taxonomies with each an unlimited amount of terms).</p>
<p><em>How to go about this? I am thinking to code the follo... | [
{
"answer_id": 326111,
"author": "Milo",
"author_id": 4771,
"author_profile": "https://wordpress.stackexchange.com/users/4771",
"pm_score": 1,
"selected": false,
"text": "<p>Add brackets to the input names:</p>\n\n<pre><code><label><input type=\"checkbox\" name=\"taxonomy-name[]... | 2019/01/19 | [
"https://wordpress.stackexchange.com/questions/326109",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/108754/"
] | I Need to build an interface with a filter set (a list of checkboxes) that the user can check and click 'filter' to search with in 1 custom post-type for posts with matching terms (there are 3 custom taxonomies with each an unlimited amount of terms).
*How to go about this? I am thinking to code the following:*
I dis... | Add brackets to the input names:
```
<label><input type="checkbox" name="taxonomy-name[]" value="term">term</label>
```
It will be automatically converted to an array:
```
if( isset( $_GET['taxonomy-name'] ) ){
foreach( $_GET['taxonomy-name'] as $term ){
echo $term;
}
}
``` |
326,143 | <p>I got this code:</p>
<pre><code>function ntt_movie_shortcode($atts, $content = null)
{
return 'TEST';
}
add_shortcode('ntt_movie', 'ntt_movie_shortcode');
</code></pre>
<p>The shortcode works perfectly on a single page, but on the Home Page / in excerpts the shortcodes are rendered as an empty string. So, the ... | [
{
"answer_id": 326126,
"author": "Mohsin Ghouri",
"author_id": 159253,
"author_profile": "https://wordpress.stackexchange.com/users/159253",
"pm_score": 1,
"selected": false,
"text": "<p>You can test the site back up by creating a staging site or uploading the backup on your localhost to... | 2019/01/20 | [
"https://wordpress.stackexchange.com/questions/326143",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/33303/"
] | I got this code:
```
function ntt_movie_shortcode($atts, $content = null)
{
return 'TEST';
}
add_shortcode('ntt_movie', 'ntt_movie_shortcode');
```
The shortcode works perfectly on a single page, but on the Home Page / in excerpts the shortcodes are rendered as an empty string. So, the shortcode gets recognized ... | You can test the site back up by creating a staging site or uploading the backup on your localhost to verify how much work you have done. |
326,172 | <p>I have a simple code where I am attaching existing in the library image to a post:</p>
<pre><code>function attachToPost($attachmentId, $postId){
return wp_update_post(array(
'ID' => (int)$attachmentId,
'post_parent' => (int)$postId
));
}
</code></pre>
<p>The problem is that I can't at... | [
{
"answer_id": 326174,
"author": "Mohsin Ghouri",
"author_id": 159253,
"author_profile": "https://wordpress.stackexchange.com/users/159253",
"pm_score": 1,
"selected": false,
"text": "<p>It is not possible to assign multiple parents to the attachment. However, there is an alternative sol... | 2019/01/20 | [
"https://wordpress.stackexchange.com/questions/326172",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/152132/"
] | I have a simple code where I am attaching existing in the library image to a post:
```
function attachToPost($attachmentId, $postId){
return wp_update_post(array(
'ID' => (int)$attachmentId,
'post_parent' => (int)$postId
));
}
```
The problem is that I can't attach it to a second post.
I read... | It is not possible to assign multiple parents to the attachment. However, there is an alternative solution. You can use `update_post_meta`. to store the attachment id to the post and similarly, you can use function `get_post_meta`. for getting the attachment id. |
326,211 | <p>How can I show a post featured image by post id in gutenberg editor? I have a slider with latest posts and when I iterate through over posts I would like to show the post featured image as well. Here is my example snippet</p>
<pre><code> const cards = displayPosts.map( ( post, i ) => {
console.log(... | [
{
"answer_id": 327360,
"author": "moped",
"author_id": 160324,
"author_profile": "https://wordpress.stackexchange.com/users/160324",
"pm_score": 0,
"selected": false,
"text": "<p>I have the same question and tried some ways to get the attachment ID and URL.\nIn fact I got it, but I can't... | 2019/01/21 | [
"https://wordpress.stackexchange.com/questions/326211",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/23759/"
] | How can I show a post featured image by post id in gutenberg editor? I have a slider with latest posts and when I iterate through over posts I would like to show the post featured image as well. Here is my example snippet
```
const cards = displayPosts.map( ( post, i ) => {
console.log(post.featured_med... | A simple and effective approach
```
const editor = wp.data.select('core/editor');
const imageId = editor.getEditedPostAttribute('featured_media');
const imageObj = wp.data.select('core').getMedia(imageId);
```
ImageObj gives you a reasonable amount of image data to work with. |
326,269 | <pre><code><ul class="nav navbar-nav" id="hover_slip">
<li><a href="index.html">Home</a></li>
<li class="arrow_down"><a href="about.html">About Us</a>
<div class="sub-menu">
... | [
{
"answer_id": 327360,
"author": "moped",
"author_id": 160324,
"author_profile": "https://wordpress.stackexchange.com/users/160324",
"pm_score": 0,
"selected": false,
"text": "<p>I have the same question and tried some ways to get the attachment ID and URL.\nIn fact I got it, but I can't... | 2019/01/21 | [
"https://wordpress.stackexchange.com/questions/326269",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/159534/"
] | ```
<ul class="nav navbar-nav" id="hover_slip">
<li><a href="index.html">Home</a></li>
<li class="arrow_down"><a href="about.html">About Us</a>
<div class="sub-menu">
<ul>
<li>... | A simple and effective approach
```
const editor = wp.data.select('core/editor');
const imageId = editor.getEditedPostAttribute('featured_media');
const imageObj = wp.data.select('core').getMedia(imageId);
```
ImageObj gives you a reasonable amount of image data to work with. |
326,276 | <p>Many times I have code and I want to make sure it only runs in a rest api context, or it never runs in a rest context.</p>
<p>I know there are some hooks, but is there a function similar to <code>wp_is_doing_cron</code>?</p>
| [
{
"answer_id": 326277,
"author": "Tom J Nowell",
"author_id": 736,
"author_profile": "https://wordpress.stackexchange.com/users/736",
"pm_score": 0,
"selected": false,
"text": "<p>Yes, <code>wp_is_json_request()</code> can be used to determine if the current request is a REST API request... | 2019/01/21 | [
"https://wordpress.stackexchange.com/questions/326276",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/736/"
] | Many times I have code and I want to make sure it only runs in a rest api context, or it never runs in a rest context.
I know there are some hooks, but is there a function similar to `wp_is_doing_cron`? | I would use :
```
if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {...}
```
Source: <https://github.com/WP-API/WP-API/issues/926#issuecomment-162920686>
If you take a look to [this source code](https://github.com/WordPress/WordPress/blob/5f62cd1566d27be22d961c2a9af31f077efdecf7/wp-includes/rest-api.php#L329) on yo... |
326,335 | <p>I'm trying to figure out a way, to create a Gutenberg sidebar that is only visible on a custom post type.</p>
<p>For instance, I'd like my sidebar with settings, like a custom checkbox, only related to pages, to be inaccessible on my custom post types.</p>
<p>Instead of creating a sidebar for a specific post type,... | [
{
"answer_id": 336444,
"author": "Ahrengot",
"author_id": 23829,
"author_profile": "https://wordpress.stackexchange.com/users/23829",
"pm_score": 4,
"selected": true,
"text": "<p>I know this question is a few months old by now, but I got around this issue using the following code and tho... | 2019/01/22 | [
"https://wordpress.stackexchange.com/questions/326335",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/151781/"
] | I'm trying to figure out a way, to create a Gutenberg sidebar that is only visible on a custom post type.
For instance, I'd like my sidebar with settings, like a custom checkbox, only related to pages, to be inaccessible on my custom post types.
Instead of creating a sidebar for a specific post type, it would also be... | I know this question is a few months old by now, but I got around this issue using the following code and thought it might be helpful for others. There might be a better way, but this works:
```
import ColorSchemeSelect from "./components/color-scheme-select";
import includes from "lodash/includes";
const { select } ... |
326,345 | <p>I just have installed xampp with php 7.3.1 on mac with OS El capitan. </p>
<p>The problem that when i run a WordPress project will show:</p>
<blockquote>
<p>Warning: preg_replace(): JIT compilation failed: no more memory in
/Applications/XAMPP/xamppfiles/htdocs/wordpress/wp-includes/formatting.php
on line 21... | [
{
"answer_id": 327568,
"author": "Michael Parkinson",
"author_id": 145000,
"author_profile": "https://wordpress.stackexchange.com/users/145000",
"pm_score": 3,
"selected": false,
"text": "<p>I added the following line to the <code>php.ini</code> and restarted Apache and it worked (Xampp ... | 2019/01/22 | [
"https://wordpress.stackexchange.com/questions/326345",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/158614/"
] | I just have installed xampp with php 7.3.1 on mac with OS El capitan.
The problem that when i run a WordPress project will show:
>
> Warning: preg\_replace(): JIT compilation failed: no more memory in
> /Applications/XAMPP/xamppfiles/htdocs/wordpress/wp-includes/formatting.php
> on line 2110 Warning: preg\_match(... | I added the following line to the `php.ini` and restarted Apache and it worked (Xampp on macOS):
```
pcre.jit=0
```
This disables PCRE's just-in-time compilation.
Further information:
* <http://php.net/manual/en/pcre.configuration.php#ini.pcre.jit>
If you can't find the location of `php.ini` and are using Xampp, ... |
326,375 | <p>My website:<a href="http://up8.431.myftpupload.com/" rel="nofollow noreferrer">http://up8.431.myftpupload.com/</a></p>
<p>I recently changed the words under We Serve under the main image to links. After I did that, when I hovered over them they changed to the background color that they are in. I would like them to ... | [
{
"answer_id": 326379,
"author": "RiddleMeThis",
"author_id": 86845,
"author_profile": "https://wordpress.stackexchange.com/users/86845",
"pm_score": -1,
"selected": true,
"text": "<p>Replace the style you added with the following.</p>\n\n<pre><code>.elementor-element-1fc9820 a:hover {\n... | 2019/01/22 | [
"https://wordpress.stackexchange.com/questions/326375",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/159272/"
] | My website:<http://up8.431.myftpupload.com/>
I recently changed the words under We Serve under the main image to links. After I did that, when I hovered over them they changed to the background color that they are in. I would like them to change to blue when I hover over them.
In the scrrenshot I have up the styling ... | Replace the style you added with the following.
```
.elementor-element-1fc9820 a:hover {
color:blue !important;
}
```
You needed to be more specific with your rule. Since there is a elementor class around those links I just used that class.
Note: Your #3 solution should have worked so apparently you made a mist... |
326,387 | <p>Basically what I'm asking is, is <code>wp_ajax_nopriv</code> exclusive to non-logged-in users?</p>
<p>Will a <code>wp_ajax_nopriv</code> action fire if a user is logged in?</p>
| [
{
"answer_id": 326389,
"author": "Pat J",
"author_id": 16121,
"author_profile": "https://wordpress.stackexchange.com/users/16121",
"pm_score": 4,
"selected": true,
"text": "<p>Looking at <a href=\"https://core.trac.wordpress.org/browser/tags/5.0.3/src/wp-admin/admin-ajax.php#L114\" rel=\... | 2019/01/22 | [
"https://wordpress.stackexchange.com/questions/326387",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/22588/"
] | Basically what I'm asking is, is `wp_ajax_nopriv` exclusive to non-logged-in users?
Will a `wp_ajax_nopriv` action fire if a user is logged in? | Looking at [the WordPress source code](https://core.trac.wordpress.org/browser/tags/5.0.3/src/wp-admin/admin-ajax.php#L114), I'd say that `wp_ajax_nopriv_*` fires *only* if you're not logged in, and `wp_ajax_*` fires otherwise.
Here's the relevant bit, in `admin-ajax.php`, lines 85-115 in version 5.0.3:
```
if ( is_u... |
326,399 | <p>I am working with the onClick action on a custom IconButton like so:</p>
<pre><code>const { createHigherOrderComponent } = wp.compose;
const { Fragment } = wp.element;
const { BlockControls } = wp.editor;
const { Toolbar } = wp.components;
const { IconButton } = wp.components;
const withCollapseControl = createHi... | [
{
"answer_id": 326465,
"author": "criticalWP",
"author_id": 159617,
"author_profile": "https://wordpress.stackexchange.com/users/159617",
"pm_score": 2,
"selected": false,
"text": "<p>I was able to solve this by wrapping the BlockEdit component in my own markup:</p>\n\n<pre><code> <... | 2019/01/23 | [
"https://wordpress.stackexchange.com/questions/326399",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/159617/"
] | I am working with the onClick action on a custom IconButton like so:
```
const { createHigherOrderComponent } = wp.compose;
const { Fragment } = wp.element;
const { BlockControls } = wp.editor;
const { Toolbar } = wp.components;
const { IconButton } = wp.components;
const withCollapseControl = createHigherOrderCompo... | I was able to solve this by wrapping the BlockEdit component in my own markup:
```
<Fragment>
<div className="customClass">
<BlockEdit { ...props }/>
<div>
<BlockControls>
<Toolbar>
<IconButton { ...iconProps } />
</Toolbar>
</BlockControls>
</Fragment>... |
326,417 | <p>On a virtual private server machine (Ubuntu 16.04) which I self-host on DigitalOcean I use an all-default and latest <em>Debian</em> stable with all-default and latest <em>Apache</em>, <em>MySQL</em> and <em>PHP</em> to host my WordPress websites.</p>
<p>Port 25 is unfiltered.</p>
<p>None of the WordPresses is on ... | [
{
"answer_id": 326465,
"author": "criticalWP",
"author_id": 159617,
"author_profile": "https://wordpress.stackexchange.com/users/159617",
"pm_score": 2,
"selected": false,
"text": "<p>I was able to solve this by wrapping the BlockEdit component in my own markup:</p>\n\n<pre><code> <... | 2019/01/23 | [
"https://wordpress.stackexchange.com/questions/326417",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | On a virtual private server machine (Ubuntu 16.04) which I self-host on DigitalOcean I use an all-default and latest *Debian* stable with all-default and latest *Apache*, *MySQL* and *PHP* to host my WordPress websites.
Port 25 is unfiltered.
None of the WordPresses is on debug mode.
Each Wordpress website contains ... | I was able to solve this by wrapping the BlockEdit component in my own markup:
```
<Fragment>
<div className="customClass">
<BlockEdit { ...props }/>
<div>
<BlockControls>
<Toolbar>
<IconButton { ...iconProps } />
</Toolbar>
</BlockControls>
</Fragment>... |
326,461 | <p>I am creating a plugin with custom gutenberg blocks.</p>
<p>Each block has a styles.scss file. If I add code to this file, the block is styled in both the back end and front end, as expected per the docs.</p>
<p>For example, in a block "section" I want to style the background color only on the back end:</p>
<pre... | [
{
"answer_id": 326477,
"author": "Steve",
"author_id": 23610,
"author_profile": "https://wordpress.stackexchange.com/users/23610",
"pm_score": 1,
"selected": false,
"text": "<p>FWIW, there was an error in the <code>wp_enqueue_style</code> function I received. This one works fine:</p>\n\... | 2019/01/23 | [
"https://wordpress.stackexchange.com/questions/326461",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/23610/"
] | I am creating a plugin with custom gutenberg blocks.
Each block has a styles.scss file. If I add code to this file, the block is styled in both the back end and front end, as expected per the docs.
For example, in a block "section" I want to style the background color only on the back end:
```
.wp-block-pbdsblocks-s... | FWIW, there was an error in the `wp_enqueue_style` function I received. This one works fine:
```
// Enqueue optional editor only styles
wp_enqueue_style(
'pbdsblocks-blocks-editor-css',
plugins_url( $editorStylePath, __FILE__),
[ ],
filemtime( plugin_dir_path( __FILE__ ) . $edi... |
326,462 | <p>Is it possible to limit the categories so that user in a list of groups does not see these posts at all? Not even in a list of posts?</p>
<p>I'm using the answer from here:</p>
<p><a href="https://wordpress.stackexchange.com/questions/113500/only-show-category-to-certain-user-levels-without-plugin">Only show categ... | [
{
"answer_id": 326477,
"author": "Steve",
"author_id": 23610,
"author_profile": "https://wordpress.stackexchange.com/users/23610",
"pm_score": 1,
"selected": false,
"text": "<p>FWIW, there was an error in the <code>wp_enqueue_style</code> function I received. This one works fine:</p>\n\... | 2019/01/23 | [
"https://wordpress.stackexchange.com/questions/326462",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/159653/"
] | Is it possible to limit the categories so that user in a list of groups does not see these posts at all? Not even in a list of posts?
I'm using the answer from here:
[Only show category to certain user levels without plugin](https://wordpress.stackexchange.com/questions/113500/only-show-category-to-certain-user-level... | FWIW, there was an error in the `wp_enqueue_style` function I received. This one works fine:
```
// Enqueue optional editor only styles
wp_enqueue_style(
'pbdsblocks-blocks-editor-css',
plugins_url( $editorStylePath, __FILE__),
[ ],
filemtime( plugin_dir_path( __FILE__ ) . $edi... |
326,497 | <p>I have a custom post-type 'News' which has multiple custom taxonomies 'news-category', 'news-tags'. Each post contains between 4-8 'news-tags' and 1 'news-category'.</p>
<p>For my current post, I'd like to display related posts based on common 'news-tags' terms added to my current post, while also matching the 'new... | [
{
"answer_id": 326648,
"author": "Bram",
"author_id": 60517,
"author_profile": "https://wordpress.stackexchange.com/users/60517",
"pm_score": 4,
"selected": true,
"text": "<p>Let's split the problem up in three bits: retrieving the related posts from the database, sorting them and displa... | 2019/01/24 | [
"https://wordpress.stackexchange.com/questions/326497",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/159719/"
] | I have a custom post-type 'News' which has multiple custom taxonomies 'news-category', 'news-tags'. Each post contains between 4-8 'news-tags' and 1 'news-category'.
For my current post, I'd like to display related posts based on common 'news-tags' terms added to my current post, while also matching the 'news-category... | Let's split the problem up in three bits: retrieving the related posts from the database, sorting them and displaying the result.
Post retrieval
--------------
This is possible using the [taxonomy parameters](https://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters) offered in `WP_Query`.
Let's first... |
326,503 | <p>I am trying to write a <code>.htaccess</code> rule to redirect the URL to a subdomain.</p>
<p>Example: <code>example.com/pagecategory/page-single</code> → <code>pagecategory.example.com/page-single</code></p>
<p>I've added wildcard subdomain on my hosting.</p>
<p>Can anyone help me write the <code>.htaccess</code... | [
{
"answer_id": 326648,
"author": "Bram",
"author_id": 60517,
"author_profile": "https://wordpress.stackexchange.com/users/60517",
"pm_score": 4,
"selected": true,
"text": "<p>Let's split the problem up in three bits: retrieving the related posts from the database, sorting them and displa... | 2019/01/24 | [
"https://wordpress.stackexchange.com/questions/326503",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/159725/"
] | I am trying to write a `.htaccess` rule to redirect the URL to a subdomain.
Example: `example.com/pagecategory/page-single` → `pagecategory.example.com/page-single`
I've added wildcard subdomain on my hosting.
Can anyone help me write the `.htaccess` code? | Let's split the problem up in three bits: retrieving the related posts from the database, sorting them and displaying the result.
Post retrieval
--------------
This is possible using the [taxonomy parameters](https://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters) offered in `WP_Query`.
Let's first... |
326,530 | <p>I need to disable the Gutenberg text-settings tab in all Blocks. Is this possible with a funtion in funtions.php?</p>
<p>I could disable the colors tab, but found no solution for the text-settings:</p>
<pre><code>function disable_tabs() {
add_theme_support( 'editor-color-palette' );
add_theme_support( 'dis... | [
{
"answer_id": 332375,
"author": "WebElaine",
"author_id": 102815,
"author_profile": "https://wordpress.stackexchange.com/users/102815",
"pm_score": 3,
"selected": false,
"text": "<p>The closest I can find in <a href=\"https://wordpress.org/gutenberg/handbook/designers-developers/develop... | 2019/01/24 | [
"https://wordpress.stackexchange.com/questions/326530",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/81609/"
] | I need to disable the Gutenberg text-settings tab in all Blocks. Is this possible with a funtion in funtions.php?
I could disable the colors tab, but found no solution for the text-settings:
```
function disable_tabs() {
add_theme_support( 'editor-color-palette' );
add_theme_support( 'disable-custom-colors' )... | The closest I can find in [the documentation](https://wordpress.org/gutenberg/handbook/designers-developers/developers/themes/theme-support/) is disabling custom font size (the text input) and forcing the dropdown font size to only contain "Normal".
```
add_action('after_setup_theme', 'wpse_remove_custom_colors');
fun... |