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
336,389
<p>I have a problem with a cron schedule function, it does not want to send an email with the <code>wp_mail()</code> function.</p> <p><strong>This is my code:</strong></p> <p>It is placed in the functions.php</p> <pre class="lang-php prettyprint-override"><code>&lt;?php add_filter('cron_schedules', 'add_review_...
[ { "answer_id": 336372, "author": "Sally CJ", "author_id": 137402, "author_profile": "https://wordpress.stackexchange.com/users/137402", "pm_score": 1, "selected": false, "text": "<blockquote>\n <p>I would like to be able to output this as a shortcode to add anywhere\n within the post</...
2019/04/26
[ "https://wordpress.stackexchange.com/questions/336389", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/165422/" ]
I have a problem with a cron schedule function, it does not want to send an email with the `wp_mail()` function. **This is my code:** It is placed in the functions.php ```php <?php add_filter('cron_schedules', 'add_review_invites_schedule'); function add_review_invites_schedule($schedules){ $schedul...
Put this in `functions.php` of your theme. ``` add_shortcode( 'dansk_url', 'dansk_url' ); function dansk_url() { $output=''; $the_url= get_post_meta( get_the_ID(), 'dansk_url', true ); if ( $the_url) $output .= '<a href="' . esc_url( $the_url) . '">Dansk</a>'; return $output; } ``` and use shortco...
336,433
<p>I'm currently getting the data from a custom taxonomy using this:</p> <pre><code>$terms = get_terms(array( 'taxonomy' =&gt; 'my_custom_taxonomy_name', 'hide_empty' =&gt; true )); </code></pre> <p>Now, this returns a lot of stuff in each <code>WP_Term</code> object; <code>term_id</code>, <code>name</code>, ...
[ { "answer_id": 336372, "author": "Sally CJ", "author_id": 137402, "author_profile": "https://wordpress.stackexchange.com/users/137402", "pm_score": 1, "selected": false, "text": "<blockquote>\n <p>I would like to be able to output this as a shortcode to add anywhere\n within the post</...
2019/04/26
[ "https://wordpress.stackexchange.com/questions/336433", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/166782/" ]
I'm currently getting the data from a custom taxonomy using this: ``` $terms = get_terms(array( 'taxonomy' => 'my_custom_taxonomy_name', 'hide_empty' => true )); ``` Now, this returns a lot of stuff in each `WP_Term` object; `term_id`, `name`, `slug`, `term_group`, `term_taxonomy_id`, `taxonomy`, `descriptio...
Put this in `functions.php` of your theme. ``` add_shortcode( 'dansk_url', 'dansk_url' ); function dansk_url() { $output=''; $the_url= get_post_meta( get_the_ID(), 'dansk_url', true ); if ( $the_url) $output .= '<a href="' . esc_url( $the_url) . '">Dansk</a>'; return $output; } ``` and use shortco...
336,572
<p>i'm using Advanced Custom Fields plugins and i want to display the fields on my posts. So i modified the single.php file of my theme like this:</p> <pre><code>&lt;ul&gt; &lt;li&gt;&lt;?php the_field('name_of_placement'); ?&gt;&lt;/li&gt; &lt;li&gt;&lt;?php the_field('country'); ?&gt;&lt;/li&gt; &lt;li&g...
[ { "answer_id": 336546, "author": "Antti Koskinen", "author_id": 144392, "author_profile": "https://wordpress.stackexchange.com/users/144392", "pm_score": 1, "selected": false, "text": "<p>I think <em>\"how\"</em> depends mostly on the theme (or page builder plugin) you're using. </p>\n\n...
2019/04/29
[ "https://wordpress.stackexchange.com/questions/336572", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/166978/" ]
i'm using Advanced Custom Fields plugins and i want to display the fields on my posts. So i modified the single.php file of my theme like this: ``` <ul> <li><?php the_field('name_of_placement'); ?></li> <li><?php the_field('country'); ?></li> <li><?php the_field('timeframe'); ?></li> <li><?php the_fiel...
I think *"how"* depends mostly on the theme (or page builder plugin) you're using. If the posts section is hard-coded to a page or an archive template then you could [copy the template to a child theme](https://developer.wordpress.org/themes/advanced-topics/child-themes/#adding-template-files) and make the required c...
336,574
<p>I am trying to get the terms from all the taxonomies in an array. but this throws an error like this ..not sure why. Is it the wrong method?:</p> <blockquote> <p>Fatal error: syntax error, unexpected '=>' (T_DOUBLE_ARROW), expecting ',' or ')'</p> </blockquote> <pre><code>public function pggggo_list_of_terms()...
[ { "answer_id": 336575, "author": "Jacob Peattie", "author_id": 39152, "author_profile": "https://wordpress.stackexchange.com/users/39152", "pm_score": 2, "selected": true, "text": "<p>This is a PHP syntax error. You're attempting to pass an array to <code>get_terms()</code> but haven't u...
2019/04/29
[ "https://wordpress.stackexchange.com/questions/336574", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I am trying to get the terms from all the taxonomies in an array. but this throws an error like this ..not sure why. Is it the wrong method?: > > Fatal error: syntax error, unexpected '=>' (T\_DOUBLE\_ARROW), expecting > ',' or ')' > > > ``` public function pggggo_list_of_terms(){ $terms = get_terms( '...
This is a PHP syntax error. You're attempting to pass an array to `get_terms()` but haven't used `array()` or `[]` to make it an array. This means that `=>` is invalid here. The code should be: ``` public function pggggo_list_of_terms() { $terms = get_terms( [ 'taxonomy' => [ 'v...
336,587
<p>I have the standard blog post format and gallery format. I have excluded all the gallery posts from the index.php page so only standard posts show up there. However, the gallery format posts are still being counted for pagination and there is just a blank space on the pagination pages where there would be a gallery ...
[ { "answer_id": 336575, "author": "Jacob Peattie", "author_id": 39152, "author_profile": "https://wordpress.stackexchange.com/users/39152", "pm_score": 2, "selected": true, "text": "<p>This is a PHP syntax error. You're attempting to pass an array to <code>get_terms()</code> but haven't u...
2019/04/29
[ "https://wordpress.stackexchange.com/questions/336587", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/165412/" ]
I have the standard blog post format and gallery format. I have excluded all the gallery posts from the index.php page so only standard posts show up there. However, the gallery format posts are still being counted for pagination and there is just a blank space on the pagination pages where there would be a gallery pos...
This is a PHP syntax error. You're attempting to pass an array to `get_terms()` but haven't used `array()` or `[]` to make it an array. This means that `=>` is invalid here. The code should be: ``` public function pggggo_list_of_terms() { $terms = get_terms( [ 'taxonomy' => [ 'v...
336,588
<p>I am trying &amp; learning to build custom block/template for Gutenberg and would like to "pre-set" CSS class for some specific block. Is it possible to add it like below?</p> <p>Refer: [Template and Block][1]</p> <p>For example, defined CSS class for one of the heading <code>blockHeadStyle</code>: </p> <pre><cod...
[ { "answer_id": 336630, "author": "Welcher", "author_id": 27210, "author_profile": "https://wordpress.stackexchange.com/users/27210", "pm_score": 2, "selected": false, "text": "<p>This can be done using the <a href=\"https://wordpress.org/gutenberg/handbook/designers-developers/developers...
2019/04/29
[ "https://wordpress.stackexchange.com/questions/336588", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/166651/" ]
I am trying & learning to build custom block/template for Gutenberg and would like to "pre-set" CSS class for some specific block. Is it possible to add it like below? Refer: [Template and Block][1] For example, defined CSS class for one of the heading `blockHeadStyle`: ``` function myplugin_register_book_post_type...
This can be done using the [block filters API](https://wordpress.org/gutenberg/handbook/designers-developers/developers/filters/block-filters/). Here is an example of adding a class to the block in the editor. ``` const withClientIdClassName = createHigherOrderComponent( ( BlockListBlock ) => { return ( props ) ...
336,605
<p>1 - I have a CPT, with 10 posts.</p> <p>2 - I have 10 users</p> <hr> <p>Q : How can i assign a single post from my CPT, to an unique user ? -> Each user must see only it's assigned post</p> <p>(Each post will be assigned by the admin of the site)</p> <p>Thanks</p>
[ { "answer_id": 336630, "author": "Welcher", "author_id": 27210, "author_profile": "https://wordpress.stackexchange.com/users/27210", "pm_score": 2, "selected": false, "text": "<p>This can be done using the <a href=\"https://wordpress.org/gutenberg/handbook/designers-developers/developers...
2019/04/29
[ "https://wordpress.stackexchange.com/questions/336605", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/162471/" ]
1 - I have a CPT, with 10 posts. 2 - I have 10 users --- Q : How can i assign a single post from my CPT, to an unique user ? -> Each user must see only it's assigned post (Each post will be assigned by the admin of the site) Thanks
This can be done using the [block filters API](https://wordpress.org/gutenberg/handbook/designers-developers/developers/filters/block-filters/). Here is an example of adding a class to the block in the editor. ``` const withClientIdClassName = createHigherOrderComponent( ( BlockListBlock ) => { return ( props ) ...
336,647
<p>I deployed my wordpress site in Google Cloud Compute Engine. To enable SSL I followed the the steps outlined here <a href="https://www.onepagezen.com/free-ssl-certificate-wordpress-google-cloud-click-to-deploy" rel="nofollow noreferrer">https://www.onepagezen.com/free-ssl-certificate-wordpress-google-cloud-click-to-...
[ { "answer_id": 336630, "author": "Welcher", "author_id": 27210, "author_profile": "https://wordpress.stackexchange.com/users/27210", "pm_score": 2, "selected": false, "text": "<p>This can be done using the <a href=\"https://wordpress.org/gutenberg/handbook/designers-developers/developers...
2019/04/29
[ "https://wordpress.stackexchange.com/questions/336647", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/167042/" ]
I deployed my wordpress site in Google Cloud Compute Engine. To enable SSL I followed the the steps outlined here <https://www.onepagezen.com/free-ssl-certificate-wordpress-google-cloud-click-to-deploy> 1. Install Certbot Client 2. Generate Certificates 3. Configure the Certificates 4. Enable HTTPS Redirect 5. Restart...
This can be done using the [block filters API](https://wordpress.org/gutenberg/handbook/designers-developers/developers/filters/block-filters/). Here is an example of adding a class to the block in the editor. ``` const withClientIdClassName = createHigherOrderComponent( ( BlockListBlock ) => { return ( props ) ...
336,672
<p>We have a WordPress blog, google is indexing <code>http</code> as well as <code>https</code> urls. Now we are considering to either redirect <code>https</code> to <code>http</code>, or to use <code>https</code> and redirect all <code>http</code> traffic there. And how can we make all necessary changes to our WordPre...
[ { "answer_id": 336741, "author": "Arvind Singh", "author_id": 113501, "author_profile": "https://wordpress.stackexchange.com/users/113501", "pm_score": 0, "selected": false, "text": "<p>You can paste this code in the <strong>wp-config.php</strong> file to define your new URL. </p>\n\n<pr...
2019/04/30
[ "https://wordpress.stackexchange.com/questions/336672", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/161485/" ]
We have a WordPress blog, google is indexing `http` as well as `https` urls. Now we are considering to either redirect `https` to `http`, or to use `https` and redirect all `http` traffic there. And how can we make all necessary changes to our WordPress installation?
If available always use `https`, it is securer for obvious reasons, it is better received by search engines and browsers nowadays, it is just overall preferable. **1 Backup** Should go without saying, but backup your database. There is always a possibility that something goes wrong. Additionally, make sure you have ...
336,674
<p>I'm working on a _products catalog` WP theme. I have a issue where my CTP has multiple subcategories, like for example:</p> <p><code>Vehicle -&gt; Vehicle type -&gt; Vehicle type -&gt; Vehicle year -&gt; Vehicle</code> or</p> <p><code>Car -&gt; SUV -&gt; VW -&gt; 2018 -&gt; T-Roc</code></p> <p>How can I create th...
[ { "answer_id": 336741, "author": "Arvind Singh", "author_id": 113501, "author_profile": "https://wordpress.stackexchange.com/users/113501", "pm_score": 0, "selected": false, "text": "<p>You can paste this code in the <strong>wp-config.php</strong> file to define your new URL. </p>\n\n<pr...
2019/04/30
[ "https://wordpress.stackexchange.com/questions/336674", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/59688/" ]
I'm working on a \_products catalog` WP theme. I have a issue where my CTP has multiple subcategories, like for example: `Vehicle -> Vehicle type -> Vehicle type -> Vehicle year -> Vehicle` or `Car -> SUV -> VW -> 2018 -> T-Roc` How can I create that structure? For now my `functions.php` looks like: ``` <?php func...
If available always use `https`, it is securer for obvious reasons, it is better received by search engines and browsers nowadays, it is just overall preferable. **1 Backup** Should go without saying, but backup your database. There is always a possibility that something goes wrong. Additionally, make sure you have ...
336,681
<p>I have the below code cobbled together. I've got it saved in a standalone PHP file so I can just run it on demand.</p> <p>It should be pretty clear what it's meant to do: loop over all posts of type 'product' and 'product-variation', then use preg_replace to remove all div and span tags.</p> <p>For some reason tho...
[ { "answer_id": 336741, "author": "Arvind Singh", "author_id": 113501, "author_profile": "https://wordpress.stackexchange.com/users/113501", "pm_score": 0, "selected": false, "text": "<p>You can paste this code in the <strong>wp-config.php</strong> file to define your new URL. </p>\n\n<pr...
2019/04/30
[ "https://wordpress.stackexchange.com/questions/336681", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/109355/" ]
I have the below code cobbled together. I've got it saved in a standalone PHP file so I can just run it on demand. It should be pretty clear what it's meant to do: loop over all posts of type 'product' and 'product-variation', then use preg\_replace to remove all div and span tags. For some reason though, the below f...
If available always use `https`, it is securer for obvious reasons, it is better received by search engines and browsers nowadays, it is just overall preferable. **1 Backup** Should go without saying, but backup your database. There is always a possibility that something goes wrong. Additionally, make sure you have ...
336,687
<p>I have a WordPress website with a custom post type called 'Courses'. </p> <p>On the WordPress dashboard page listing each course I've added a new column displaying a custom field, which is a date, called 'online start'. The online start date is a manually specified date that has no relation to the publish date of t...
[ { "answer_id": 336741, "author": "Arvind Singh", "author_id": 113501, "author_profile": "https://wordpress.stackexchange.com/users/113501", "pm_score": 0, "selected": false, "text": "<p>You can paste this code in the <strong>wp-config.php</strong> file to define your new URL. </p>\n\n<pr...
2019/04/30
[ "https://wordpress.stackexchange.com/questions/336687", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/78294/" ]
I have a WordPress website with a custom post type called 'Courses'. On the WordPress dashboard page listing each course I've added a new column displaying a custom field, which is a date, called 'online start'. The online start date is a manually specified date that has no relation to the publish date of the post. ...
If available always use `https`, it is securer for obvious reasons, it is better received by search engines and browsers nowadays, it is just overall preferable. **1 Backup** Should go without saying, but backup your database. There is always a possibility that something goes wrong. Additionally, make sure you have ...
336,708
<p>I'm running multisite. Looking to replace old URLs with new URLs for pulling a copy of the site form one environment to another environment. </p> <p><strong>Here is my command:</strong></p> <pre><code>wp search-replace --url=domain.com https://domain.com https://domain.test --all-tables --network --recurse-objects...
[ { "answer_id": 336741, "author": "Arvind Singh", "author_id": 113501, "author_profile": "https://wordpress.stackexchange.com/users/113501", "pm_score": 0, "selected": false, "text": "<p>You can paste this code in the <strong>wp-config.php</strong> file to define your new URL. </p>\n\n<pr...
2019/04/30
[ "https://wordpress.stackexchange.com/questions/336708", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/9579/" ]
I'm running multisite. Looking to replace old URLs with new URLs for pulling a copy of the site form one environment to another environment. **Here is my command:** ``` wp search-replace --url=domain.com https://domain.com https://domain.test --all-tables --network --recurse-objects --skip-columns=guid --dry-run --a...
If available always use `https`, it is securer for obvious reasons, it is better received by search engines and browsers nowadays, it is just overall preferable. **1 Backup** Should go without saying, but backup your database. There is always a possibility that something goes wrong. Additionally, make sure you have ...
336,709
<p>I'm building a custom shortcode in Wordpress. Essentially what I want this to do is the following:</p> <ol> <li>Dynamically pull values from a group of Advanced Custom Fields</li> <li>Output those values into a javascript array, comma-separated</li> </ol> <p>Where I'm getting stuck is that I can successfully run a...
[ { "answer_id": 336741, "author": "Arvind Singh", "author_id": 113501, "author_profile": "https://wordpress.stackexchange.com/users/113501", "pm_score": 0, "selected": false, "text": "<p>You can paste this code in the <strong>wp-config.php</strong> file to define your new URL. </p>\n\n<pr...
2019/04/30
[ "https://wordpress.stackexchange.com/questions/336709", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/167100/" ]
I'm building a custom shortcode in Wordpress. Essentially what I want this to do is the following: 1. Dynamically pull values from a group of Advanced Custom Fields 2. Output those values into a javascript array, comma-separated Where I'm getting stuck is that I can successfully run a loop over the group of fields an...
If available always use `https`, it is securer for obvious reasons, it is better received by search engines and browsers nowadays, it is just overall preferable. **1 Backup** Should go without saying, but backup your database. There is always a possibility that something goes wrong. Additionally, make sure you have ...
336,710
<p>Is there a way to remove &amp; redirect any users of a site from accessing</p> <pre><code>https://www.example.com/wp-admin/ </code></pre> <p>Unless there id is one, i have seen some examples floating around the ask if admin-ajax is being used if so redirect. how ever this is not approach i wish to make as im using...
[ { "answer_id": 336741, "author": "Arvind Singh", "author_id": 113501, "author_profile": "https://wordpress.stackexchange.com/users/113501", "pm_score": 0, "selected": false, "text": "<p>You can paste this code in the <strong>wp-config.php</strong> file to define your new URL. </p>\n\n<pr...
2019/04/30
[ "https://wordpress.stackexchange.com/questions/336710", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/167096/" ]
Is there a way to remove & redirect any users of a site from accessing ``` https://www.example.com/wp-admin/ ``` Unless there id is one, i have seen some examples floating around the ask if admin-ajax is being used if so redirect. how ever this is not approach i wish to make as im using admin ajax on the front end f...
If available always use `https`, it is securer for obvious reasons, it is better received by search engines and browsers nowadays, it is just overall preferable. **1 Backup** Should go without saying, but backup your database. There is always a possibility that something goes wrong. Additionally, make sure you have ...
336,766
<p><a href="https://i.stack.imgur.com/huVKs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/huVKs.png" alt="enter image description here"></a></p> <p>The problem we are experiencing is very new to us. We did not experience this ever before with our website or with our web server (in last 8 years). J...
[ { "answer_id": 336808, "author": "Rick Hellewell", "author_id": 29416, "author_profile": "https://wordpress.stackexchange.com/users/29416", "pm_score": 0, "selected": false, "text": "<p>I'd recommend updating WP, and all themes and plugins to current versions. And you might check the ver...
2019/05/01
[ "https://wordpress.stackexchange.com/questions/336766", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/167148/" ]
[![enter image description here](https://i.stack.imgur.com/huVKs.png)](https://i.stack.imgur.com/huVKs.png) The problem we are experiencing is very new to us. We did not experience this ever before with our website or with our web server (in last 8 years). Just recently for last 2 week we have this issue and it happen...
I don't think this can provide a solution but hopefully I can help you troubleshoot a little. Firstly, let's go over debugging: ### Debugging You're saying "white screen of death", but the screenshot you provided looks more like it's hanging while trying to load the page. Typically, the WSOD appears as exactly that ...
336,780
<p>I have added a meta box in the page edit section:</p> <pre><code>add_meta_box('custom_section_box', 'Sections', array($this, 'section_box'), 'page','normal','high'); </code></pre> <p>Within the box, there is a wp_editor call:</p> <pre><code>$tinymce_options = array('plugins' =&gt; "table,lists,link,textcolor,hr",...
[ { "answer_id": 336786, "author": "anton", "author_id": 97934, "author_profile": "https://wordpress.stackexchange.com/users/97934", "pm_score": 1, "selected": false, "text": "<p>Make sure <code>tinymce</code> option has a valid value. <br/>\nRemove it or set it to true if you don't pass a...
2019/05/01
[ "https://wordpress.stackexchange.com/questions/336780", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/92425/" ]
I have added a meta box in the page edit section: ``` add_meta_box('custom_section_box', 'Sections', array($this, 'section_box'), 'page','normal','high'); ``` Within the box, there is a wp\_editor call: ``` $tinymce_options = array('plugins' => "table,lists,link,textcolor,hr", 'toolbar1'=>"fontsizeselect,forecolor,...
This piece works perfectly: ``` $tinymce_options = array( 'plugins' => "paste,lists,link,textcolor,hr,media,wordpress,wpeditimage,wpgallery,wpdialogs,wplink,wpview", 'wordpress_adv_hidden'=> false, 'toolbar1'=>"formatselect,fontsizeselect,forecolor,backcolor,bold,italic,underline,strikethrough,alignleft,aligncenter,al...
336,787
<p>Below is my code:</p> <pre><code> wp_nav_menu( array( 'menu', _('My Custom Header Menu'), 'theme_location' =&gt; 'my_custom_location', ) ); </code></pre> <hr> <p>And as result, I obtain all Wordpress page's menu link instead of the menu of My Custom Header Menu.</p>
[ { "answer_id": 336788, "author": "Amine Faiz", "author_id": 66813, "author_profile": "https://wordpress.stackexchange.com/users/66813", "pm_score": 1, "selected": false, "text": "<p>First check if you have already registred a menu location with the same name : </p>\n\n<pre><code>register...
2019/05/01
[ "https://wordpress.stackexchange.com/questions/336787", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/167169/" ]
Below is my code: ``` wp_nav_menu( array( 'menu', _('My Custom Header Menu'), 'theme_location' => 'my_custom_location', ) ); ``` --- And as result, I obtain all Wordpress page's menu link instead of the menu of My Custom Header Menu.
**Register your navigation menu** Add this code to your functions.php file. ``` function my_custom_new_menu() { register_nav_menu('my-custom-menu',__( 'My Custom Menu' )); } add_action( 'init', 'my_custom_new_menu' ); ``` **Create new menu** You can now go to Appearance » Menus page in your WordPress ...
336,801
<p>I have a WP installation that needs moving to a new site URL. </p> <p>I have tried the usual methods listed on <a href="https://codex.wordpress.org/Changing_The_Site_URL" rel="nofollow noreferrer">this codex</a>. All of them produce the same problem. When I hit a link like this on the site:</p> <p><code>&lt;a href...
[ { "answer_id": 336788, "author": "Amine Faiz", "author_id": 66813, "author_profile": "https://wordpress.stackexchange.com/users/66813", "pm_score": 1, "selected": false, "text": "<p>First check if you have already registred a menu location with the same name : </p>\n\n<pre><code>register...
2019/05/01
[ "https://wordpress.stackexchange.com/questions/336801", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/167177/" ]
I have a WP installation that needs moving to a new site URL. I have tried the usual methods listed on [this codex](https://codex.wordpress.org/Changing_The_Site_URL). All of them produce the same problem. When I hit a link like this on the site: `<a href="https://site.mydomain.com/path/to/post">` The web server re...
**Register your navigation menu** Add this code to your functions.php file. ``` function my_custom_new_menu() { register_nav_menu('my-custom-menu',__( 'My Custom Menu' )); } add_action( 'init', 'my_custom_new_menu' ); ``` **Create new menu** You can now go to Appearance » Menus page in your WordPress ...
336,802
<p>I'm using the example from <a href="https://developer.wordpress.org/reference/functions/add_image_size/" rel="nofollow noreferrer">add_image_size() | WordPress Developer Resources</a> to try to add custom image sizes to the admin media selector.</p> <pre><code>add_filter( 'image_size_names_choose', 'my_custom_sizes...
[ { "answer_id": 336803, "author": "Welcher", "author_id": 27210, "author_profile": "https://wordpress.stackexchange.com/users/27210", "pm_score": 1, "selected": false, "text": "<p>Try defining the <code>my_custom_sizes()</code> function outside of the <code>setup()</code> function.</p>\n\...
2019/05/01
[ "https://wordpress.stackexchange.com/questions/336802", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/101490/" ]
I'm using the example from [add\_image\_size() | WordPress Developer Resources](https://developer.wordpress.org/reference/functions/add_image_size/) to try to add custom image sizes to the admin media selector. ``` add_filter( 'image_size_names_choose', 'my_custom_sizes' ); function my_custom_sizes( $sizes ) { re...
You can't define a hook callback function inside another function. You've defined `my_custom_sizes()` inside `setup()`, which means that `my_custom_sizes()` cannot be called outside of the scope of `setup()`. This is a problem because the hook, `image_size_names_choose`, is not run inside your `setup()` function. You...
336,807
<p>I have this function </p> <pre><code>$tags = get_tags( array('exclude' =&gt; 11, 12) ) </code></pre> <p>Which excludes specific tags 11 and 12. But without manually having to add each tag <strong>ID</strong> I don't want shown, how do I exclude the category that these tags are coming from?</p>
[ { "answer_id": 336803, "author": "Welcher", "author_id": 27210, "author_profile": "https://wordpress.stackexchange.com/users/27210", "pm_score": 1, "selected": false, "text": "<p>Try defining the <code>my_custom_sizes()</code> function outside of the <code>setup()</code> function.</p>\n\...
2019/05/01
[ "https://wordpress.stackexchange.com/questions/336807", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/132008/" ]
I have this function ``` $tags = get_tags( array('exclude' => 11, 12) ) ``` Which excludes specific tags 11 and 12. But without manually having to add each tag **ID** I don't want shown, how do I exclude the category that these tags are coming from?
You can't define a hook callback function inside another function. You've defined `my_custom_sizes()` inside `setup()`, which means that `my_custom_sizes()` cannot be called outside of the scope of `setup()`. This is a problem because the hook, `image_size_names_choose`, is not run inside your `setup()` function. You...
336,821
<p>Ultimately I'm wanting to add some custom widget fields to the existing default image widget, and define it as a new custom widget.</p> <p>I'm trying to create my own by extending the <code>WP_Widget_Media_Image</code> class, like this:</p> <pre><code>class Theme_Image_Widget extends WP_Widget_Media_Image { /*...
[ { "answer_id": 336803, "author": "Welcher", "author_id": 27210, "author_profile": "https://wordpress.stackexchange.com/users/27210", "pm_score": 1, "selected": false, "text": "<p>Try defining the <code>my_custom_sizes()</code> function outside of the <code>setup()</code> function.</p>\n\...
2019/05/01
[ "https://wordpress.stackexchange.com/questions/336821", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/109171/" ]
Ultimately I'm wanting to add some custom widget fields to the existing default image widget, and define it as a new custom widget. I'm trying to create my own by extending the `WP_Widget_Media_Image` class, like this: ``` class Theme_Image_Widget extends WP_Widget_Media_Image { /** * Widget identifier. ...
You can't define a hook callback function inside another function. You've defined `my_custom_sizes()` inside `setup()`, which means that `my_custom_sizes()` cannot be called outside of the scope of `setup()`. This is a problem because the hook, `image_size_names_choose`, is not run inside your `setup()` function. You...
336,839
<p>I am building a custom solution where I am needing to obtain all the meta values for a post into an array. I have many "keys". Is there a way to loop through them all without doing this? I have the post ID at this point in my script.</p> <pre><code>$image_meta = get_post_meta( $post-&gt;ID, 'image', true ); //...
[ { "answer_id": 336844, "author": "phatskat", "author_id": 20143, "author_profile": "https://wordpress.stackexchange.com/users/20143", "pm_score": 2, "selected": false, "text": "<p>As @Sally CJ noted in the comment to your question, you should just omit the meta key:</p>\n\n<pre class=\"l...
2019/05/01
[ "https://wordpress.stackexchange.com/questions/336839", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/116635/" ]
I am building a custom solution where I am needing to obtain all the meta values for a post into an array. I have many "keys". Is there a way to loop through them all without doing this? I have the post ID at this point in my script. ``` $image_meta = get_post_meta( $post->ID, 'image', true ); // car year $car_year...
As @Sally CJ noted in the comment to your question, you should just omit the meta key: ```php $meta = get_post_meta( $post->ID, '', true ); echo $meta['car_year']; // 2005 ``` In PHP 7.1 you can use [array destructing](https://php.net/manual/en/migration71.new-features.php#migration71.new-features.symmetric-array-d...
336,857
<p>I have the following, which successfully inserts a dynamic link as the <em>last</em> top-level menu item of the specified menu:</p> <pre><code>add_filter( 'wp_nav_menu_items', 'example_last_nav_item', 10, 2 ); function example_last_nav_item( $items, $args ) { if ( $args - &gt; theme_location == 'account-menu' ...
[ { "answer_id": 336864, "author": "anton", "author_id": 97934, "author_profile": "https://wordpress.stackexchange.com/users/97934", "pm_score": 0, "selected": false, "text": "<p>I recommend you to use <code>wp_nav_menu_objects</code> hook, which allows you to work with menu items as objec...
2019/05/02
[ "https://wordpress.stackexchange.com/questions/336857", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/167210/" ]
I have the following, which successfully inserts a dynamic link as the *last* top-level menu item of the specified menu: ``` add_filter( 'wp_nav_menu_items', 'example_last_nav_item', 10, 2 ); function example_last_nav_item( $items, $args ) { if ( $args - > theme_location == 'account-menu' && is_user_logged_in() )...
The following code will go through all items and search the first item that has a parent. If found, new item with the same parent will be inserted as "first child". ``` add_filter( 'wp_nav_menu_objects', 'se336857_dynamic_submenuitem', 20, 2 ); function se336857_dynamic_submenuitem( $items, $args ) { if ( !is_user...
336,859
<p>So what I would like to do is, move the content of example.com/blog to yolo.com/blog. The yolo.com website is already live and has contents in it. So I just want to move my existing blog to a subdirectory on yolo.com. I have access to the Cpanels of both websites.</p>
[ { "answer_id": 336864, "author": "anton", "author_id": 97934, "author_profile": "https://wordpress.stackexchange.com/users/97934", "pm_score": 0, "selected": false, "text": "<p>I recommend you to use <code>wp_nav_menu_objects</code> hook, which allows you to work with menu items as objec...
2019/05/02
[ "https://wordpress.stackexchange.com/questions/336859", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/167209/" ]
So what I would like to do is, move the content of example.com/blog to yolo.com/blog. The yolo.com website is already live and has contents in it. So I just want to move my existing blog to a subdirectory on yolo.com. I have access to the Cpanels of both websites.
The following code will go through all items and search the first item that has a parent. If found, new item with the same parent will be inserted as "first child". ``` add_filter( 'wp_nav_menu_objects', 'se336857_dynamic_submenuitem', 20, 2 ); function se336857_dynamic_submenuitem( $items, $args ) { if ( !is_user...
336,877
<p>If anyone know, if there's plugin to customize taxonomy list it will be faster to do.<br> But here's my question.</p> <p>i create post type <strong>"product"</strong> and the categories.<br> inside post type <strong>product</strong>, i make categories like this</p> <ul> <li>Book <ul> <li>Novel</li> <li>Dictionary...
[ { "answer_id": 336864, "author": "anton", "author_id": 97934, "author_profile": "https://wordpress.stackexchange.com/users/97934", "pm_score": 0, "selected": false, "text": "<p>I recommend you to use <code>wp_nav_menu_objects</code> hook, which allows you to work with menu items as objec...
2019/05/02
[ "https://wordpress.stackexchange.com/questions/336877", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/167224/" ]
If anyone know, if there's plugin to customize taxonomy list it will be faster to do. But here's my question. i create post type **"product"** and the categories. inside post type **product**, i make categories like this * Book + Novel + Dictionary - English - Korean * Gadget + Phone + Tablet So, in th...
The following code will go through all items and search the first item that has a parent. If found, new item with the same parent will be inserted as "first child". ``` add_filter( 'wp_nav_menu_objects', 'se336857_dynamic_submenuitem', 20, 2 ); function se336857_dynamic_submenuitem( $items, $args ) { if ( !is_user...
336,890
<p>The title basically says it all. I'm piecing through publishing my first theme and have copied the woocommerce template files right from the plugin. So they should be identical with no current changes. However, when I add theme support in functions.php I no longer have products displayed. The declaration is basicall...
[ { "answer_id": 336896, "author": "user3135691", "author_id": 59755, "author_profile": "https://wordpress.stackexchange.com/users/59755", "pm_score": 1, "selected": false, "text": "<p>See this post for <a href=\"https://wordpress.stackexchange.com/questions/304776/how-to-override-woocomme...
2019/05/02
[ "https://wordpress.stackexchange.com/questions/336890", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/103843/" ]
The title basically says it all. I'm piecing through publishing my first theme and have copied the woocommerce template files right from the plugin. So they should be identical with no current changes. However, when I add theme support in functions.php I no longer have products displayed. The declaration is basically r...
See this post for [WooCommerce templating mechanism](https://wordpress.stackexchange.com/questions/304776/how-to-override-woocommerce-specific-loop-or-archive-product-php/304804#304804). One basic principle is: only overwrite things that you want to customize, not more. So you should remove all files that are not chan...
336,891
<p>In wooCommerce admin product pages, on variable products you can have product variations. See below the "variations" settings section:</p> <p><a href="https://i.stack.imgur.com/1fdxE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1fdxE.png" alt="enter image description here"></a></p> <p><strong...
[ { "answer_id": 336896, "author": "user3135691", "author_id": 59755, "author_profile": "https://wordpress.stackexchange.com/users/59755", "pm_score": 1, "selected": false, "text": "<p>See this post for <a href=\"https://wordpress.stackexchange.com/questions/304776/how-to-override-woocomme...
2019/05/02
[ "https://wordpress.stackexchange.com/questions/336891", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/167237/" ]
In wooCommerce admin product pages, on variable products you can have product variations. See below the "variations" settings section: [![enter image description here](https://i.stack.imgur.com/1fdxE.png)](https://i.stack.imgur.com/1fdxE.png) **What Im trying to achieve:** I have already been able to add a text fie...
See this post for [WooCommerce templating mechanism](https://wordpress.stackexchange.com/questions/304776/how-to-override-woocommerce-specific-loop-or-archive-product-php/304804#304804). One basic principle is: only overwrite things that you want to customize, not more. So you should remove all files that are not chan...
336,935
<p>Hello am trying to print the user id inside an JavaScript</p> <pre><code>&lt;script type="text/javascript"&gt; Li.re('ab12','$user_id'); &lt;/script&gt; </code></pre> <p>i wanna output like</p> <pre><code>&lt;script type="text/javascript"&gt; Li.re('ab12','12'); &lt;/script&gt; </code></pre> <p>12 is...
[ { "answer_id": 336938, "author": "Sally CJ", "author_id": 137402, "author_profile": "https://wordpress.stackexchange.com/users/137402", "pm_score": 3, "selected": true, "text": "<p>You can use <code>get_current_user_id()</code> to get the ID of the current user, and in your case, you can...
2019/05/02
[ "https://wordpress.stackexchange.com/questions/336935", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/108699/" ]
Hello am trying to print the user id inside an JavaScript ``` <script type="text/javascript"> Li.re('ab12','$user_id'); </script> ``` i wanna output like ``` <script type="text/javascript"> Li.re('ab12','12'); </script> ``` 12 is the number of the login in user. Is possible inside shortcode? ``` <?p...
You can use `get_current_user_id()` to get the ID of the current user, and in your case, you can do so to print the user ID in the JavaScript `Li.re()` call: ```php <script type="text/javascript"> Li.re( 'ab12','<?php echo get_current_user_id(); ?>' ); </script> ``` And yes, you can include the user ID as part of ...
336,940
<p>This is a WordPress site and I'm using bootstrap. </p> <p>Site is <a href="https://doodle.gatewaywebdesign.com/" rel="nofollow noreferrer">https://doodle.gatewaywebdesign.com/</a></p> <p>Basically I'm just trying to get rid of the initial top margin. So instead of this:</p> <p><a href="https://i.stack.imgur.com/I...
[ { "answer_id": 336945, "author": "Rick Hellewell", "author_id": 29416, "author_profile": "https://wordpress.stackexchange.com/users/29416", "pm_score": 0, "selected": false, "text": "<p>Your best bet is to use the Inspector tool in your browser (F12, usually). Position the cursor at the ...
2019/05/03
[ "https://wordpress.stackexchange.com/questions/336940", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/116029/" ]
This is a WordPress site and I'm using bootstrap. Site is <https://doodle.gatewaywebdesign.com/> Basically I'm just trying to get rid of the initial top margin. So instead of this: [![enter image description here](https://i.stack.imgur.com/Iv0Bl.png)](https://i.stack.imgur.com/Iv0Bl.png) It should look like this: ...
That looks like the margin added by the WP admin bar when you are logged into the site. WP adds an inline style tag which sets the margin on the html element with an !important flag. Since it typically comes after any of your own styles it overrides them even if you also use !important. Since it only displays when you ...
336,953
<p>At the bottom of my page I am trying to display some recent projects based on a pre-selected list of post IDs.</p> <p>I have built a custom query to try and retrieve the 3 specific posts (WHERE custom_post_type = project) at the bottom of my page</p> <pre><code>$projectIDs = array( [0] =&gt; 79, [1] =&gt; 98, [2] ...
[ { "answer_id": 336954, "author": "Tanmay Patel", "author_id": 62026, "author_profile": "https://wordpress.stackexchange.com/users/62026", "pm_score": 0, "selected": false, "text": "<p>In Wordpress 3.5 and up you can use 'orderby'=>'post__in' then you must write this:</p>\n\n<pre><code>&l...
2019/05/03
[ "https://wordpress.stackexchange.com/questions/336953", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10368/" ]
At the bottom of my page I am trying to display some recent projects based on a pre-selected list of post IDs. I have built a custom query to try and retrieve the 3 specific posts (WHERE custom\_post\_type = project) at the bottom of my page ``` $projectIDs = array( [0] => 79, [1] => 98, [2] => 108 ); $args = array(...
*(Revised to improve the wording)* Actually, you **do not** have to set the `orderby` to `post__in` for `post__in` query to work. There's no such limitation in WordPress and you'd only need to set `'orderby' => 'post__in'` when you want to sort the posts exactly in the same order as the post IDs in the `post__in` para...
336,973
<p>I was searching for a solution to remove the "Most Used" group of blocks from Gutenberg editor and couldn't find any, is there any way?</p> <p><a href="https://i.stack.imgur.com/4zNqR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4zNqR.png" alt="enter image description here"></a></p>
[ { "answer_id": 336954, "author": "Tanmay Patel", "author_id": 62026, "author_profile": "https://wordpress.stackexchange.com/users/62026", "pm_score": 0, "selected": false, "text": "<p>In Wordpress 3.5 and up you can use 'orderby'=>'post__in' then you must write this:</p>\n\n<pre><code>&l...
2019/05/03
[ "https://wordpress.stackexchange.com/questions/336973", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/115614/" ]
I was searching for a solution to remove the "Most Used" group of blocks from Gutenberg editor and couldn't find any, is there any way? [![enter image description here](https://i.stack.imgur.com/4zNqR.png)](https://i.stack.imgur.com/4zNqR.png)
*(Revised to improve the wording)* Actually, you **do not** have to set the `orderby` to `post__in` for `post__in` query to work. There's no such limitation in WordPress and you'd only need to set `'orderby' => 'post__in'` when you want to sort the posts exactly in the same order as the post IDs in the `post__in` para...
336,998
<p>Is this method of operation on the database is safe and correct?</p> <pre><code> if(isset($_POST['name'])){ $table = $wpdb-&gt;prefix.'_my_table'; $post = trim(sanitize_user($_POST['name'], true)); $part = $this-&gt;wpdb-&gt;prepare("WHERE name = %s", $post) $results = $this-&gt;wpdb-&gt;get_res...
[ { "answer_id": 337001, "author": "Stephan Samuel", "author_id": 85968, "author_profile": "https://wordpress.stackexchange.com/users/85968", "pm_score": 3, "selected": true, "text": "<p>You're asking several questions:</p>\n\n<ol>\n<li><strong>Does WP create a new PHP file for each post?<...
2019/05/03
[ "https://wordpress.stackexchange.com/questions/336998", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/163538/" ]
Is this method of operation on the database is safe and correct? ``` if(isset($_POST['name'])){ $table = $wpdb->prefix.'_my_table'; $post = trim(sanitize_user($_POST['name'], true)); $part = $this->wpdb->prepare("WHERE name = %s", $post) $results = $this->wpdb->get_results("SELECT * FROM {$table} ...
You're asking several questions: 1. **Does WP create a new PHP file for each post?** No, it does not. Your statement, "[insert] a database [record]," is correct. The record it creates for a post (and also many other post types) is in the `wp_posts` (your prefix may not be `wp_`) table. 2. **Is it SEO-friendly?** This ...
337,022
<p>I'm trying to re-order the search results using the <code>pre_get_posts</code> hook and set the <code>orderby</code> parameter to relevance. I also want to put priority posts, which is based on post meta <code>_prioritize_s</code> to be placed first in the results. Then all the posts after will be based on relevance...
[ { "answer_id": 337233, "author": "RachieVee", "author_id": 42783, "author_profile": "https://wordpress.stackexchange.com/users/42783", "pm_score": 3, "selected": true, "text": "<p>So after @Nicolai found that blurb in the WP source confirming that I can't use multiple parameters in the <...
2019/05/03
[ "https://wordpress.stackexchange.com/questions/337022", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/42783/" ]
I'm trying to re-order the search results using the `pre_get_posts` hook and set the `orderby` parameter to relevance. I also want to put priority posts, which is based on post meta `_prioritize_s` to be placed first in the results. Then all the posts after will be based on relevance as usual. Here's the code I've bee...
So after @Nicolai found that blurb in the WP source confirming that I can't use multiple parameters in the `orderby` if I am ordering by `relevance` I had to go a different route. However, this route only works if I don't care for pagination. There probably is a way to put it back, but I'm working on a different soluti...
337,056
<p>I have set 1024M in <code>php.ini</code> file:</p> <pre><code>memory_limit = 1024M </code></pre> <p>I have set it in <code>.htaccess</code> file:</p> <pre><code>&lt;IfModule mod_php7.c&gt; php_value memory_limit 1024M &lt;/IfModule&gt; </code></pre> <p>I have set it in <code>wp-config.php</code> file:</p> <...
[ { "answer_id": 337057, "author": "Pratik Patel", "author_id": 143123, "author_profile": "https://wordpress.stackexchange.com/users/143123", "pm_score": 0, "selected": false, "text": "<p>Try to create <code>.user.ini</code> file in root and put below code</p>\n\n<pre><code>upload_max_file...
2019/05/04
[ "https://wordpress.stackexchange.com/questions/337056", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/130259/" ]
I have set 1024M in `php.ini` file: ``` memory_limit = 1024M ``` I have set it in `.htaccess` file: ``` <IfModule mod_php7.c> php_value memory_limit 1024M </IfModule> ``` I have set it in `wp-config.php` file: ``` define( 'WP_MAX_MEMORY_LIMIT' , '1024M'); define( 'WP_MEMORY_LIMIT', '1024M' ); ``` But I sti...
Try to create `.user.ini` file in root and put below code ``` upload_max_filesize = 500M post_max_size = 256M memory_limit = 500M max_execution_time = 300 max_input_vars = 500M ``` Try and let me know if any query. Hope it will help!
337,076
<p>I have a quite specific problem, I created a query that currently has to display the first post differently from the rest and everything seemed to work, but there is a problem that displays the title twice can some help? This is my code:</p> <pre><code> // args $args = array( ...
[ { "answer_id": 337081, "author": "Krzysiek Dróżdż", "author_id": 34172, "author_profile": "https://wordpress.stackexchange.com/users/34172", "pm_score": 0, "selected": false, "text": "<p>It shows title twice, because your code should do exactly that...</p>\n\n<p>You can clearly see it, i...
2019/05/04
[ "https://wordpress.stackexchange.com/questions/337076", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/167376/" ]
I have a quite specific problem, I created a query that currently has to display the first post differently from the rest and everything seemed to work, but there is a problem that displays the title twice can some help? This is my code: ``` // args $args = array( '...
Try this. The code has comments where modified. ``` <?php // args $args = array( 'showposts' => 5, 'post_type' => 'post', 'orderby' => 'date', // 'order' => 'ASC', 'meta_query' => array( ...
337,090
<p>Hello can anyone please give me the code, and tell me where to put it, for how to the change the first letter or the active menu item to red?</p> <p>thank you</p>
[ { "answer_id": 337092, "author": "Rick Hellewell", "author_id": 29416, "author_profile": "https://wordpress.stackexchange.com/users/29416", "pm_score": 1, "selected": false, "text": "<p>You can use CSS to change the first letter of a 'div' (class or element). See <a href=\"https://www.w3...
2019/05/04
[ "https://wordpress.stackexchange.com/questions/337090", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/167392/" ]
Hello can anyone please give me the code, and tell me where to put it, for how to the change the first letter or the active menu item to red? thank you
1. CSS `::first-letter` ======================= The first option is [selector CSS](https://www.w3schools.com/cssref/sel_firstletter.asp) `::first-letter`. ``` li.menu-item.active a::first-letter { color: red; } ``` The `a` tag inside menu should have `display: block` / `display: inline-block`. > > **Note**: The...
337,160
<p>I am facing an issue in the Avada vertical menu when the homepage is opened. Please note that all "Home", "Company profile" and "Servizi" link to the same page (the homepage).</p> <p>The sub-menu under "Servizi" is already opened while I would prefer it was closed by default, and that it could be opened simply by h...
[ { "answer_id": 337162, "author": "Vishwa", "author_id": 120712, "author_profile": "https://wordpress.stackexchange.com/users/120712", "pm_score": 2, "selected": true, "text": "<p>To do that, you have to set <code>hidden</code> attribute to the sub menu.</p>\n\n<p><strong>CSS</strong></p>...
2019/05/06
[ "https://wordpress.stackexchange.com/questions/337160", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/167468/" ]
I am facing an issue in the Avada vertical menu when the homepage is opened. Please note that all "Home", "Company profile" and "Servizi" link to the same page (the homepage). The sub-menu under "Servizi" is already opened while I would prefer it was closed by default, and that it could be opened simply by hovering "s...
To do that, you have to set `hidden` attribute to the sub menu. **CSS** ``` #wrapper .fusion-vertical-menu-widget.left .menu .sub-menu { display: none; } ``` to toggle display on the menu on hover over servizi, you can add jQuery hover to the menu item. **jQuery** ``` var subMenu = jQuery("#wrapper .fusion-ve...
337,163
<p>My client's WooCommerce shop is exporting orders as comma separated files for creation of packaging labels and accounting in C5.</p> <p>When users enter an address with a comma upon checkout, this screws up the CSV export. Example: "60 Brickyard Road, Lapeer". The comma after "Road" confuses C5 when importing.</p> ...
[ { "answer_id": 337168, "author": "Skovsgaard", "author_id": 114926, "author_profile": "https://wordpress.stackexchange.com/users/114926", "pm_score": 0, "selected": false, "text": "<p>I managed to prohibit the use of commas in both address fields with the following code. Add it to your f...
2019/05/06
[ "https://wordpress.stackexchange.com/questions/337163", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/114926/" ]
My client's WooCommerce shop is exporting orders as comma separated files for creation of packaging labels and accounting in C5. When users enter an address with a comma upon checkout, this screws up the CSV export. Example: "60 Brickyard Road, Lapeer". The comma after "Road" confuses C5 when importing. How can I fil...
You can remove/replace comas from address\_1 and address\_2 billing and shipping fields with the following, once order is submitted *(before saving data)*: ``` // Checkout/Order: Remove/replace comas from adresses fields add_action('woocommerce_checkout_create_order', 'remove_comas_from_address_fields', 10, 2 ); funct...
337,180
<p>I'm trying to find a way to permanently remove the <code>delete_attachment</code> button from the media details modal. I don't want to use CSS to do it... and haven't been able to find a way as of now. Does anyone have an idea ? </p>
[ { "answer_id": 337190, "author": "WebElaine", "author_id": 102815, "author_profile": "https://wordpress.stackexchange.com/users/102815", "pm_score": 3, "selected": true, "text": "<p>Rather than focusing on the button itself, focus on what you want users to do. If you don't want your user...
2019/05/06
[ "https://wordpress.stackexchange.com/questions/337180", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I'm trying to find a way to permanently remove the `delete_attachment` button from the media details modal. I don't want to use CSS to do it... and haven't been able to find a way as of now. Does anyone have an idea ?
Rather than focusing on the button itself, focus on what you want users to do. If you don't want your users to be able to delete media, and you are also comfortable with them not being able to delete other post types (Posts, Pages, etc.), you can create a custom role for these users. ``` <?php // In a plugin, add_role...
337,192
<p>In WooCommerce, I am trying to send an email notification to the customer, when an order has a status "cancelled". </p> <p>Here is my code placed in my child theme's function.php file:</p> <pre><code>add_filter('woocommerce_order_status_changed', 'send_mail_abandonned_order', 10, 4); function woocommerce_send_mail...
[ { "answer_id": 337276, "author": "Oliver", "author_id": 161218, "author_profile": "https://wordpress.stackexchange.com/users/161218", "pm_score": -1, "selected": true, "text": "<p>Here is the solution...</p>\n\n<pre>\n\n// CHANGE THE HOOK DESCRIPTION\nadd_filter('woocommerce_order_status...
2019/05/06
[ "https://wordpress.stackexchange.com/questions/337192", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/161218/" ]
In WooCommerce, I am trying to send an email notification to the customer, when an order has a status "cancelled". Here is my code placed in my child theme's function.php file: ``` add_filter('woocommerce_order_status_changed', 'send_mail_abandonned_order', 10, 4); function woocommerce_send_mail_abandonned_order($or...
Here is the solution... ``` // CHANGE THE HOOK DESCRIPTION add_filter('woocommerce_order_status_cancelled', 'woocommerce_send_mail_abandonned_order',21, 1); function woocommerce_send_mail_abandonned_order($order_id) { if (!$order_id) return; $order = wc_get_order($order_id); if ($order->has_status('cancel...
337,196
<p>I have a custom theme. I've deactivated every plugin. I can't get the Featured Image block on the right sidebar of editing a post to show up so that the user can set the featured image. </p> <p>I have this in my functions.php file:</p> <pre><code>add_theme_support( 'post-thumbnails' ); </code></pre> <p>Note that ...
[ { "answer_id": 337210, "author": "RailsTweeter", "author_id": 48623, "author_profile": "https://wordpress.stackexchange.com/users/48623", "pm_score": 2, "selected": false, "text": "<p>The function with the add_theme_support( 'post-thumbnails' ); wasn't being called for some reason. Once ...
2019/05/06
[ "https://wordpress.stackexchange.com/questions/337196", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/48623/" ]
I have a custom theme. I've deactivated every plugin. I can't get the Featured Image block on the right sidebar of editing a post to show up so that the user can set the featured image. I have this in my functions.php file: ``` add_theme_support( 'post-thumbnails' ); ``` Note that this worked fine before Wordpress...
The function with the add\_theme\_support( 'post-thumbnails' ); wasn't being called for some reason. Once I fixed that, everything works now.
337,238
<p>I have a WordPress site, with WooCommerce. The WooCommerce archives pages as shop display a dropdown sorting filter like in this screenshot: </p> <p><a href="https://i.stack.imgur.com/Z44XN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Z44XN.png" alt="enter image description here"></a> Now in a...
[ { "answer_id": 337210, "author": "RailsTweeter", "author_id": 48623, "author_profile": "https://wordpress.stackexchange.com/users/48623", "pm_score": 2, "selected": false, "text": "<p>The function with the add_theme_support( 'post-thumbnails' ); wasn't being called for some reason. Once ...
2019/05/06
[ "https://wordpress.stackexchange.com/questions/337238", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/165273/" ]
I have a WordPress site, with WooCommerce. The WooCommerce archives pages as shop display a dropdown sorting filter like in this screenshot: [![enter image description here](https://i.stack.imgur.com/Z44XN.png)](https://i.stack.imgur.com/Z44XN.png) Now in another page let's say `example.com/foo` On that page I use a ...
The function with the add\_theme\_support( 'post-thumbnails' ); wasn't being called for some reason. Once I fixed that, everything works now.
337,261
<p><a href="https://i.stack.imgur.com/rBHsk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rBHsk.png" alt="enter image description here"></a></p> <p>These are actually input fields. paragraph is the textarea field. i query the contents from database and try to show them in this textarea field. But ...
[ { "answer_id": 337262, "author": "Shohidur Rahman", "author_id": 163783, "author_profile": "https://wordpress.stackexchange.com/users/163783", "pm_score": -1, "selected": false, "text": "<p>Can you please try this php function <code>html_entity_decode(get_the_content());</code>. I have u...
2019/05/07
[ "https://wordpress.stackexchange.com/questions/337261", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/149458/" ]
[![enter image description here](https://i.stack.imgur.com/rBHsk.png)](https://i.stack.imgur.com/rBHsk.png) These are actually input fields. paragraph is the textarea field. i query the contents from database and try to show them in this textarea field. But the textarea field is showing me unwanted comments and tags. ...
Can you please try this php function `html_entity_decode(get_the_content());`. I have used this function on php to remove html tags, you can try this.
337,290
<p>I am trying to add a css file specific to 3 pages using the <code>is_page(postid)</code> for a WordPress website in the <code>functions.php</code> </p> <pre><code> if (is_page(1) || is_page(2) || is_page(3) ) { echo "&lt;script&gt;console.log('insideIf');&lt;/script&gt;"; wp_enqueue_style( 'cu...
[ { "answer_id": 337262, "author": "Shohidur Rahman", "author_id": 163783, "author_profile": "https://wordpress.stackexchange.com/users/163783", "pm_score": -1, "selected": false, "text": "<p>Can you please try this php function <code>html_entity_decode(get_the_content());</code>. I have u...
2019/05/07
[ "https://wordpress.stackexchange.com/questions/337290", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/150032/" ]
I am trying to add a css file specific to 3 pages using the `is_page(postid)` for a WordPress website in the `functions.php` ``` if (is_page(1) || is_page(2) || is_page(3) ) { echo "<script>console.log('insideIf');</script>"; wp_enqueue_style( 'custom_css', get_template_directory_child() . path...
Can you please try this php function `html_entity_decode(get_the_content());`. I have used this function on php to remove html tags, you can try this.
337,331
<p>I'd like my custom post type, products, to not use a slug, eg: domain.com/product-name. The code below sorts that out nicely, however it fails to work with child pages, eg: domain.com/product-name/product-name-feature, it 404s.</p> <p>I originally tried giving the custom post type the rewrite slug as '/', and while...
[ { "answer_id": 337262, "author": "Shohidur Rahman", "author_id": 163783, "author_profile": "https://wordpress.stackexchange.com/users/163783", "pm_score": -1, "selected": false, "text": "<p>Can you please try this php function <code>html_entity_decode(get_the_content());</code>. I have u...
2019/05/07
[ "https://wordpress.stackexchange.com/questions/337331", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/167570/" ]
I'd like my custom post type, products, to not use a slug, eg: domain.com/product-name. The code below sorts that out nicely, however it fails to work with child pages, eg: domain.com/product-name/product-name-feature, it 404s. I originally tried giving the custom post type the rewrite slug as '/', and while this was ...
Can you please try this php function `html_entity_decode(get_the_content());`. I have used this function on php to remove html tags, you can try this.
337,348
<p>I am able to successfully use <code>wp.hooks.applyFilters()</code> and <code>wp.hooks.addFilter()</code>, but I'm not able to render a React Component using <code>wp.hooks.addAction()</code>. However, the <code>console.log()</code> runs just fine within the callback for an action. This is my code:</p> <pre><code>im...
[ { "answer_id": 337349, "author": "Sally CJ", "author_id": 137402, "author_profile": "https://wordpress.stackexchange.com/users/137402", "pm_score": 4, "selected": true, "text": "<h2>How to use <code>wp.hooks.addAction</code>?</h2>\n<p>It's basically like so, just like you've attempted:</...
2019/05/06
[ "https://wordpress.stackexchange.com/questions/337348", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/67538/" ]
I am able to successfully use `wp.hooks.applyFilters()` and `wp.hooks.addFilter()`, but I'm not able to render a React Component using `wp.hooks.addAction()`. However, the `console.log()` runs just fine within the callback for an action. This is my code: ``` import { createHooks } from '@wordpress/hooks'; let globalH...
How to use `wp.hooks.addAction`? -------------------------------- It's basically like so, just like you've attempted: ```js // Hook to the hook_name action. wp.hooks.addAction( 'hook_name', 'namespace', function(){ console.log( 'Foo Bar' ); } ); // Trigger the hook_name action. wp.hooks.doAction( 'hook_name' ); ...
337,353
<p>How can I fetch the post which is posted only this hour?</p> <p>Example: It's 9:00 am here I want to show all the post that is posted within 9:00am to 10am and it will check all the hours in same way.</p>
[ { "answer_id": 337349, "author": "Sally CJ", "author_id": 137402, "author_profile": "https://wordpress.stackexchange.com/users/137402", "pm_score": 4, "selected": true, "text": "<h2>How to use <code>wp.hooks.addAction</code>?</h2>\n<p>It's basically like so, just like you've attempted:</...
2019/05/08
[ "https://wordpress.stackexchange.com/questions/337353", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/157754/" ]
How can I fetch the post which is posted only this hour? Example: It's 9:00 am here I want to show all the post that is posted within 9:00am to 10am and it will check all the hours in same way.
How to use `wp.hooks.addAction`? -------------------------------- It's basically like so, just like you've attempted: ```js // Hook to the hook_name action. wp.hooks.addAction( 'hook_name', 'namespace', function(){ console.log( 'Foo Bar' ); } ); // Trigger the hook_name action. wp.hooks.doAction( 'hook_name' ); ...
337,366
<p>Anyone know how can I change the comment reply text in wordpress to only reflect on specific pages only and not the whole site?</p> <p>For example the default text site-wide is “Leave a Reply”. But for some specific pages only, I want the text to read “Leave a Review”.</p> <p>Is there some code I could use in the ...
[ { "answer_id": 337367, "author": "Vishwa", "author_id": 120712, "author_profile": "https://wordpress.stackexchange.com/users/120712", "pm_score": 0, "selected": false, "text": "<p>In your page template, when you call comments template like this, <code>&lt;?php comment_form(); ?&gt;</code...
2019/05/08
[ "https://wordpress.stackexchange.com/questions/337366", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/167600/" ]
Anyone know how can I change the comment reply text in wordpress to only reflect on specific pages only and not the whole site? For example the default text site-wide is “Leave a Reply”. But for some specific pages only, I want the text to read “Leave a Review”. Is there some code I could use in the comments.php file...
Code is not tested. But theoretically it should work: ``` add_filter('comment_form_defaults', 'wpse337366_comment_form_modification'); function wpse337366_comment_form_modification($defaults) { // put your condition here if( is_page('my-page') || is_singular('my_post_type') ) { $defaults['title_rep...
337,415
<p>I am using this plugin <a href="https://wordpress.org/plugins/content-protector/" rel="nofollow noreferrer">https://wordpress.org/plugins/content-protector/</a></p> <p>Enter the correct password to view the content↓</p> <pre><code>[passster password="123456"]content here[/passster] </code></pre> <p>adding to php↓...
[ { "answer_id": 337371, "author": "Sanaullah Ahmad", "author_id": 141915, "author_profile": "https://wordpress.stackexchange.com/users/141915", "pm_score": -1, "selected": false, "text": "<p>I have the same Problem in Magento, the reason was Views was not added in Database. Once i added P...
2019/05/08
[ "https://wordpress.stackexchange.com/questions/337415", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/167638/" ]
I am using this plugin <https://wordpress.org/plugins/content-protector/> Enter the correct password to view the content↓ ``` [passster password="123456"]content here[/passster] ``` adding to php↓ ``` <?php echo do_shortcode('[passster password="123456"]content here[/passster]'); ?> ``` He can work But I ne...
<https://github.com/woocommerce/woocommerce/pull/23665/files> Refer above link to solve this error.
337,421
<p>I am working on a php code as shown below:</p> <pre><code> &lt;div class="case-breaking__content"&gt; &lt;p&gt;&lt;?php echo the_title(); ?&gt;&lt;/p&gt; &lt;/div&gt; </code></pre> <p>The above php code returns the following content:</p> <pre><code>absv shss xcnx shss hshhs shhsw shshs hsnna hssnnss ...
[ { "answer_id": 337423, "author": "leymannx", "author_id": 30597, "author_profile": "https://wordpress.stackexchange.com/users/30597", "pm_score": 1, "selected": false, "text": "<p>To trim by words you can use WordPress' <a href=\"https://developer.wordpress.org/reference/functions/wp_tri...
2019/05/08
[ "https://wordpress.stackexchange.com/questions/337421", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/143115/" ]
I am working on a php code as shown below: ``` <div class="case-breaking__content"> <p><?php echo the_title(); ?></p> </div> ``` The above php code returns the following content: ``` absv shss xcnx shss hshhs shhsw shshs hsnna hssnnss hssns snnss nnshs sjjjjsjsj nsnnnsns jjsnss snsnns nsnns ``` Wha...
[`the_title()`](https://codex.wordpress.org/Function_Reference/the_title) prints/retrieve the title while [`get_the_title()`](https://developer.wordpress.org/reference/functions/get_the_title/) retrieve the title. So your code should be something like this. ``` <div class="case-breaking__content"> <p> <?php ...
337,437
<p>I am trying to export results to a csv file using the following code. The export appears to work, but when I open the file, it contains the html code from the page. Any help is appreciated.</p> <pre><code>ob_start(); global $wpdb; $domain = $_SERVER['SERVER_NAME']; $table = $wpdb-&gt;prefix . "qi_project_requests";...
[ { "answer_id": 337423, "author": "leymannx", "author_id": 30597, "author_profile": "https://wordpress.stackexchange.com/users/30597", "pm_score": 1, "selected": false, "text": "<p>To trim by words you can use WordPress' <a href=\"https://developer.wordpress.org/reference/functions/wp_tri...
2019/05/08
[ "https://wordpress.stackexchange.com/questions/337437", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/154429/" ]
I am trying to export results to a csv file using the following code. The export appears to work, but when I open the file, it contains the html code from the page. Any help is appreciated. ``` ob_start(); global $wpdb; $domain = $_SERVER['SERVER_NAME']; $table = $wpdb->prefix . "qi_project_requests"; $filename = "exp...
[`the_title()`](https://codex.wordpress.org/Function_Reference/the_title) prints/retrieve the title while [`get_the_title()`](https://developer.wordpress.org/reference/functions/get_the_title/) retrieve the title. So your code should be something like this. ``` <div class="case-breaking__content"> <p> <?php ...
337,438
<p>I need help looping through a simple php code. What I'm trying to achieve is the following:</p> <pre><code>Start Loop Look for all the posts Add the author first &amp; last name as a tag (links to /tag/firstName-lastName) Once clicked on the tag, take me to the author page with all their posts end loop </code></pr...
[ { "answer_id": 337423, "author": "leymannx", "author_id": 30597, "author_profile": "https://wordpress.stackexchange.com/users/30597", "pm_score": 1, "selected": false, "text": "<p>To trim by words you can use WordPress' <a href=\"https://developer.wordpress.org/reference/functions/wp_tri...
2019/05/08
[ "https://wordpress.stackexchange.com/questions/337438", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/167652/" ]
I need help looping through a simple php code. What I'm trying to achieve is the following: ``` Start Loop Look for all the posts Add the author first & last name as a tag (links to /tag/firstName-lastName) Once clicked on the tag, take me to the author page with all their posts end loop ``` I'm writing all this in...
[`the_title()`](https://codex.wordpress.org/Function_Reference/the_title) prints/retrieve the title while [`get_the_title()`](https://developer.wordpress.org/reference/functions/get_the_title/) retrieve the title. So your code should be something like this. ``` <div class="case-breaking__content"> <p> <?php ...
337,455
<p>I'm Looking for a way to create the grid as on the pictures. A 12 columns based layout with a simple way to add text, images, video etc. etc. Tried the <strong>Bootstrap way</strong> without success. I’m up for everything. Anyone? </p> <p><img src="https://i.stack.imgur.com/P84Gd.png" alt="enter image description h...
[ { "answer_id": 337423, "author": "leymannx", "author_id": 30597, "author_profile": "https://wordpress.stackexchange.com/users/30597", "pm_score": 1, "selected": false, "text": "<p>To trim by words you can use WordPress' <a href=\"https://developer.wordpress.org/reference/functions/wp_tri...
2019/05/09
[ "https://wordpress.stackexchange.com/questions/337455", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/167663/" ]
I'm Looking for a way to create the grid as on the pictures. A 12 columns based layout with a simple way to add text, images, video etc. etc. Tried the **Bootstrap way** without success. I’m up for everything. Anyone? ![enter image description here](https://i.stack.imgur.com/P84Gd.png)![enter image description here](...
[`the_title()`](https://codex.wordpress.org/Function_Reference/the_title) prints/retrieve the title while [`get_the_title()`](https://developer.wordpress.org/reference/functions/get_the_title/) retrieve the title. So your code should be something like this. ``` <div class="case-breaking__content"> <p> <?php ...
337,469
<p>I am looking for any built in function that when I add a user or a user wants to register, the username will be automatically prepended with a predefined text.</p> <p>For example, if the user registers with <code>abul</code>, the username will be saved as <code>tk_abul</code>.</p>
[ { "answer_id": 337473, "author": "Nilambar Sharma", "author_id": 27998, "author_profile": "https://wordpress.stackexchange.com/users/27998", "pm_score": 1, "selected": false, "text": "<p>You can use <code>pre_user_login</code> filter to customize username when registered. Example.</p>\n\...
2019/05/09
[ "https://wordpress.stackexchange.com/questions/337469", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/118077/" ]
I am looking for any built in function that when I add a user or a user wants to register, the username will be automatically prepended with a predefined text. For example, if the user registers with `abul`, the username will be saved as `tk_abul`.
You can use `pre_user_login` filter to customize username when registered. Example. ``` add_filter( 'pre_user_login', 'wpse_customize_user' ); function wpse_customize_user( $username ) { return 'tk_' . $username; } ```
337,508
<p>I have created a plug-in which permits to create a category with slugs.</p> <p>There is the code :</p> <pre><code>wp_insert_term( 'Cat1', 'category', array( 'slug' =&gt; 'slug-cat1', )); wp_insert_term( 'Agenda', 'category', array( 'slug' =&gt; 'slug-agenda', 'parent'=&gt; term_exists( 'Cat1', 'ca...
[ { "answer_id": 337512, "author": "user3135691", "author_id": 59755, "author_profile": "https://wordpress.stackexchange.com/users/59755", "pm_score": 0, "selected": false, "text": "<p>Unfortunately, you need to buy the pro-version of Polylang. This is a feature, which the pro-version of t...
2019/05/09
[ "https://wordpress.stackexchange.com/questions/337508", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/144944/" ]
I have created a plug-in which permits to create a category with slugs. There is the code : ``` wp_insert_term( 'Cat1', 'category', array( 'slug' => 'slug-cat1', )); wp_insert_term( 'Agenda', 'category', array( 'slug' => 'slug-agenda', 'parent'=> term_exists( 'Cat1', 'category' )['term_id'] )); ```...
You can actually make it this way: ``` $cat1 = wp_insert_term( 'Cat1', 'category', ['slug' => 'slug-cat1'], ); $agenda = wp_insert_term( 'Agenda', 'category', [ 'slug' => 'slug-agenda', 'parent'=> term_exists( 'Cat1', 'category' )['term_id'], ], ); pll_set_term_language($cat1['term_id'], 'fr');...
337,516
<p>I want to return information about a blog. It could be, author name, title, date, country whatever just to test.</p> <pre><code>&lt;?php $post_id = get_the_ID(); while ($post_id != 0) { $queried_post = get_post($post_id); $author_id = $queried_post-&gt;post_author; ...
[ { "answer_id": 337518, "author": "J.Bigham", "author_id": 95150, "author_profile": "https://wordpress.stackexchange.com/users/95150", "pm_score": 0, "selected": false, "text": "<p>You will want to get the author name inside the loop. Once your inside the loop you will be dealing with one...
2019/05/09
[ "https://wordpress.stackexchange.com/questions/337516", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/167693/" ]
I want to return information about a blog. It could be, author name, title, date, country whatever just to test. ``` <?php $post_id = get_the_ID(); while ($post_id != 0) { $queried_post = get_post($post_id); $author_id = $queried_post->post_author; echo get_the_auth...
You need to re-arrange your code. ``` <?php $post_id = 20; while($post_id <= 25) { $queried_post = get_post($post_id); $author_id = $queried_post->post_author; echo get_the_author_meta('display_name', $author_id); $post_id++; } ?> ``` With...
337,525
<p>be gentle, I'm pretty new (just over from Joomla).</p> <p>This is part of an array...</p> <pre><code>echo '&lt;tr&gt;&lt;th&gt;' . esc_html( $item_1_title ) . '&lt;/th&gt;&lt;td&gt;' . esc_url( wp_get_attachment_url($row['item_code1']) ) . '&lt;/td&gt;&lt;/tr&gt;'; </code></pre> <p>It works fine, but at the front...
[ { "answer_id": 337528, "author": "Stephan Samuel", "author_id": 85968, "author_profile": "https://wordpress.stackexchange.com/users/85968", "pm_score": 1, "selected": false, "text": "<p>You're onto the answer...</p>\n\n<p>The function, <code>wp_get_attachment_url()</code> (see <a href=\"...
2019/05/09
[ "https://wordpress.stackexchange.com/questions/337525", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/167709/" ]
be gentle, I'm pretty new (just over from Joomla). This is part of an array... ``` echo '<tr><th>' . esc_html( $item_1_title ) . '</th><td>' . esc_url( wp_get_attachment_url($row['item_code1']) ) . '</td></tr>'; ``` It works fine, but at the front end, the output is plain text. I can't seem to figure out how to ren...
You're onto the answer... The function, `wp_get_attachment_url()` (see [Codex](https://codex.wordpress.org/Function_Reference/wp_get_attachment_url)) just gives you the URL. You could wrap it in a link: ``` echo '<tr><td><a href="' . esc_attr(wp_get_attachment_url($row['item_code1'])) . '">' . esc_html($item_1_title)...
337,647
<p>I recently took over a WordPress site with the following directory structure inside of <strong>/public_html</strong>:</p> <pre><code>wp_config.php /wp-admin /wp-content /wp-includes ... ... ... /development </code></pre> <p>The root (production) site is pointed to <strong>/public_html</strong>. Inside of <strong...
[ { "answer_id": 337528, "author": "Stephan Samuel", "author_id": 85968, "author_profile": "https://wordpress.stackexchange.com/users/85968", "pm_score": 1, "selected": false, "text": "<p>You're onto the answer...</p>\n\n<p>The function, <code>wp_get_attachment_url()</code> (see <a href=\"...
2019/05/11
[ "https://wordpress.stackexchange.com/questions/337647", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/167796/" ]
I recently took over a WordPress site with the following directory structure inside of **/public\_html**: ``` wp_config.php /wp-admin /wp-content /wp-includes ... ... ... /development ``` The root (production) site is pointed to **/public\_html**. Inside of **/public\_html**, I have a sub-folder called **/developme...
You're onto the answer... The function, `wp_get_attachment_url()` (see [Codex](https://codex.wordpress.org/Function_Reference/wp_get_attachment_url)) just gives you the URL. You could wrap it in a link: ``` echo '<tr><td><a href="' . esc_attr(wp_get_attachment_url($row['item_code1'])) . '">' . esc_html($item_1_title)...
337,650
<p>I am using CentOS 7 (<code>CentOS Linux release 7.6.1810 (Core)</code>), NGINX 1.15.12, WordPress 5.1</p> <p>Error</p> <blockquote> <p>Update WordPress<br> Downloading update from <a href="https://downloads.wordpress.org/release/wordpress-5.2-no-content.zip" rel="nofollow noreferrer">https://downloads.wordpres...
[ { "answer_id": 337528, "author": "Stephan Samuel", "author_id": 85968, "author_profile": "https://wordpress.stackexchange.com/users/85968", "pm_score": 1, "selected": false, "text": "<p>You're onto the answer...</p>\n\n<p>The function, <code>wp_get_attachment_url()</code> (see <a href=\"...
2019/05/11
[ "https://wordpress.stackexchange.com/questions/337650", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/164690/" ]
I am using CentOS 7 (`CentOS Linux release 7.6.1810 (Core)`), NGINX 1.15.12, WordPress 5.1 Error > > Update WordPress > > Downloading update from <https://downloads.wordpress.org/release/wordpress-5.2-no-content.zip>… > > > Unpacking the update… > > > The update cannot be installed because we will be unable ...
You're onto the answer... The function, `wp_get_attachment_url()` (see [Codex](https://codex.wordpress.org/Function_Reference/wp_get_attachment_url)) just gives you the URL. You could wrap it in a link: ``` echo '<tr><td><a href="' . esc_attr(wp_get_attachment_url($row['item_code1'])) . '">' . esc_html($item_1_title)...
337,651
<p>How to change / delete product short description in Woocommerce</p> <p>I use</p> <pre><code>$short_desc = $post-&gt;post_excerpt; </code></pre> <p>to read the property but I cant change it with</p> <pre><code> wp_set_object_terms($post-&gt;ID, $post-&gt;post_excerpt, 'new excerpt'); </code></pre>
[ { "answer_id": 337659, "author": "Alexander Holsgrove", "author_id": 48962, "author_profile": "https://wordpress.stackexchange.com/users/48962", "pm_score": 2, "selected": false, "text": "<p>You should have the <code>$product</code> global available to you, which lets you call <a href=\"...
2019/05/11
[ "https://wordpress.stackexchange.com/questions/337651", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/163748/" ]
How to change / delete product short description in Woocommerce I use ``` $short_desc = $post->post_excerpt; ``` to read the property but I cant change it with ``` wp_set_object_terms($post->ID, $post->post_excerpt, 'new excerpt'); ```
Th function [`wp_set_object_terms()`](https://codex.wordpress.org/Function_Reference/wp_set_object_terms) will not work to set post object properties. To add/update/delete product short description **there is mainly 2 ways**: 1) **the WordPress way** from a **post ID** using [`wp_update_post()`](https://codex.wordpre...
337,684
<p>I have a series of image posts displayed on a page of a WP site that uses Bootstrap 4 _ The link to the development site is also online <a href="http://inputforcolor.net/wpstudio/paintings/" rel="nofollow noreferrer">here</a> </p> <p>The images normally display in a larger size when they're clicked on but I want to...
[ { "answer_id": 337690, "author": "Sally CJ", "author_id": 137402, "author_profile": "https://wordpress.stackexchange.com/users/137402", "pm_score": 3, "selected": true, "text": "<blockquote>\n <p>I realise this is because I need to get the post ID and add the same\n ID to the modal cod...
2019/05/11
[ "https://wordpress.stackexchange.com/questions/337684", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/114778/" ]
I have a series of image posts displayed on a page of a WP site that uses Bootstrap 4 \_ The link to the development site is also online [here](http://inputforcolor.net/wpstudio/paintings/) The images normally display in a larger size when they're clicked on but I want to display them in a dropdown modal \_ The probl...
> > I realise this is because I need to get the post ID and add the same > ID to the modal code > > > No, that's not true in your case. If you want to use a *single* modal for all the different images — i.e. a different image is displayed in the modal *based on the button/link which triggers the modal* (or simply...
337,708
<p>i had a wordpress website on xampp let's say in "localhost/listing" and it was working perfectly then i installed another copy of this website on "localhost/mylisting" now the problem is that when i type "localhost/listing/wp-admin" the site redirects itself to "localhost/mylisting/wp-admin" i dont know how to solv...
[ { "answer_id": 337690, "author": "Sally CJ", "author_id": 137402, "author_profile": "https://wordpress.stackexchange.com/users/137402", "pm_score": 3, "selected": true, "text": "<blockquote>\n <p>I realise this is because I need to get the post ID and add the same\n ID to the modal cod...
2019/05/12
[ "https://wordpress.stackexchange.com/questions/337708", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/167857/" ]
i had a wordpress website on xampp let's say in "localhost/listing" and it was working perfectly then i installed another copy of this website on "localhost/mylisting" now the problem is that when i type "localhost/listing/wp-admin" the site redirects itself to "localhost/mylisting/wp-admin" i dont know how to solve t...
> > I realise this is because I need to get the post ID and add the same > ID to the modal code > > > No, that's not true in your case. If you want to use a *single* modal for all the different images — i.e. a different image is displayed in the modal *based on the button/link which triggers the modal* (or simply...
337,775
<p>I've currently got some custom theme functions running (custom single product page and java script) although want to exclude a specific category from them. How do I go about this?</p> <p>I currently have implemented a calculator into my single product using the following script;</p> <pre><code>add_action( 'wp_enqu...
[ { "answer_id": 337690, "author": "Sally CJ", "author_id": 137402, "author_profile": "https://wordpress.stackexchange.com/users/137402", "pm_score": 3, "selected": true, "text": "<blockquote>\n <p>I realise this is because I need to get the post ID and add the same\n ID to the modal cod...
2019/05/13
[ "https://wordpress.stackexchange.com/questions/337775", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/167917/" ]
I've currently got some custom theme functions running (custom single product page and java script) although want to exclude a specific category from them. How do I go about this? I currently have implemented a calculator into my single product using the following script; ``` add_action( 'wp_enqueue_scripts', 'my_scr...
> > I realise this is because I need to get the post ID and add the same > ID to the modal code > > > No, that's not true in your case. If you want to use a *single* modal for all the different images — i.e. a different image is displayed in the modal *based on the button/link which triggers the modal* (or simply...
337,795
<p>A little long-winded but trying to explain clearly :)</p> <p>I am delving into the code of my new theme and am not familiar with this type of data storing/pulling - can someone help me understand what is going on here please:</p> <p>I am trying to create a page which outputs only the posts which have a 'coupon' at...
[ { "answer_id": 337802, "author": "Warwick", "author_id": 19554, "author_profile": "https://wordpress.stackexchange.com/users/19554", "pm_score": 2, "selected": true, "text": "<p>The string you are outputting using <code>print_r()</code> is what is known as a serialized string. When Wor...
2019/05/13
[ "https://wordpress.stackexchange.com/questions/337795", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/167925/" ]
A little long-winded but trying to explain clearly :) I am delving into the code of my new theme and am not familiar with this type of data storing/pulling - can someone help me understand what is going on here please: I am trying to create a page which outputs only the posts which have a 'coupon' attached to it. 'Co...
The string you are outputting using `print_r()` is what is known as a serialized string. When WordPress stores an array of values in 1 custom field, it compresses the array into this string using a function called [serialize()](https://www.w3resource.com/php/function-reference/serialize.php) What you want to do is to ...
337,800
<p>I have a WordPress website on a Digital Ocean VPS which I've come back to and tried to log into the admin panel through the 'wp-admin' link. For some reason I can't access it now. The website gets redirected to '<a href="http://%24domain/wp-admin/" rel="nofollow noreferrer">http://%24domain/wp-admin/</a>' which is a...
[ { "answer_id": 337803, "author": "mh. bitarafan", "author_id": 94233, "author_profile": "https://wordpress.stackexchange.com/users/94233", "pm_score": 1, "selected": false, "text": "<p>first of all you shouldnt delete .htaccess file. create another one in the root directory and add follo...
2019/05/13
[ "https://wordpress.stackexchange.com/questions/337800", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/40956/" ]
I have a WordPress website on a Digital Ocean VPS which I've come back to and tried to log into the admin panel through the 'wp-admin' link. For some reason I can't access it now. The website gets redirected to '<http://%24domain/wp-admin/>' which is a broken link. Here are the current things that I have tried but not...
first of all you shouldnt delete .htaccess file. create another one in the root directory and add following lines to it: ``` # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /i...
337,804
<p>I'm just getting started with Wordpress, and currently using an XAMPP server to try and get a local installation working. The localhost environment is working fine, and I've successfully <a href="https://codex.wordpress.org/Installing_WordPress#Using_phpMyAdmin" rel="nofollow noreferrer">followed the steps here</a> ...
[ { "answer_id": 337803, "author": "mh. bitarafan", "author_id": 94233, "author_profile": "https://wordpress.stackexchange.com/users/94233", "pm_score": 1, "selected": false, "text": "<p>first of all you shouldnt delete .htaccess file. create another one in the root directory and add follo...
2019/05/13
[ "https://wordpress.stackexchange.com/questions/337804", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/167562/" ]
I'm just getting started with Wordpress, and currently using an XAMPP server to try and get a local installation working. The localhost environment is working fine, and I've successfully [followed the steps here](https://codex.wordpress.org/Installing_WordPress#Using_phpMyAdmin) to create a database and user account fo...
first of all you shouldnt delete .htaccess file. create another one in the root directory and add following lines to it: ``` # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /i...
337,813
<p>I was updating my plugins, after one plug in update went a bit wrong my site was stuck in maintenance mode, the solution I found online was to delete the .maintanence file, which I did. But straight after that I got this message: The site is experiencing technical difficulties. Please check your site admin email inb...
[ { "answer_id": 337834, "author": "Ihtisham Zahoor", "author_id": 161650, "author_profile": "https://wordpress.stackexchange.com/users/161650", "pm_score": 1, "selected": false, "text": "<p>Use your cPanel access and rename that specific plugin folder with any name. If you still don't get...
2019/05/14
[ "https://wordpress.stackexchange.com/questions/337813", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/167937/" ]
I was updating my plugins, after one plug in update went a bit wrong my site was stuck in maintenance mode, the solution I found online was to delete the .maintanence file, which I did. But straight after that I got this message: The site is experiencing technical difficulties. Please check your site admin email inbox ...
You should troubleshoot your website for plugins. As you are unable to access your WordPress admin area so please try to access your file manager in cPanel or access public\_html directory via FTP. Go to wp-content/ Directory them rename plugins/ directory to pluginsbackup/ now try to load your site. If this works t...
337,814
<p>I learned a solution from <a href="https://stackoverflow.com/questions/36671203/wordpress-publish-date-shortcode">https://stackoverflow.com/questions/36671203/wordpress-publish-date-shortcode</a></p> <p>Although it can show the publish in the title, in the source code, it still shows the shortcode [post_published]....
[ { "answer_id": 337817, "author": "Nicolai Grossherr", "author_id": 22534, "author_profile": "https://wordpress.stackexchange.com/users/22534", "pm_score": 1, "selected": false, "text": "<p>You can use the <a href=\"https://developer.wordpress.org/reference/functions/add_filter/\" rel=\"n...
2019/05/14
[ "https://wordpress.stackexchange.com/questions/337814", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/167938/" ]
I learned a solution from <https://stackoverflow.com/questions/36671203/wordpress-publish-date-shortcode> Although it can show the publish in the title, in the source code, it still shows the shortcode [post\_published]. That means the search engine will not understand. For example, assume the title name is "ABC", th...
if the output you see is `ABC [post_published]`, then it means your shortcode isn't working as it should. try including following code at the end of inside your theme's `functions.php` file. ``` function ppd_shortcode(){ return get_the_date(); } add_shortcode('ppdate', 'ppd_shortcode'); ``` When you register a sho...
337,845
<p>I have read in another SO post that Underscore.js is including in Wordpress by default. I am using it to test if a variable is defined but get this in the browser console:</p> <pre><code>pluginAdminPage.js:32 Uncaught ReferenceError: _ is not defined at pluginAdminPage.js:32 (anonymous) @ pluginAdminPage.js:32 ...
[ { "answer_id": 337849, "author": "kero", "author_id": 108180, "author_profile": "https://wordpress.stackexchange.com/users/108180", "pm_score": 3, "selected": true, "text": "<p>You need to set it as a dependency for your script, this is the best way you can make sure, Underscore.js is lo...
2019/05/14
[ "https://wordpress.stackexchange.com/questions/337845", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/165037/" ]
I have read in another SO post that Underscore.js is including in Wordpress by default. I am using it to test if a variable is defined but get this in the browser console: ``` pluginAdminPage.js:32 Uncaught ReferenceError: _ is not defined at pluginAdminPage.js:32 (anonymous) @ pluginAdminPage.js:32 _.VERSION // ...
You need to set it as a dependency for your script, this is the best way you can make sure, Underscore.js is loaded **before** your script (which means, the methods will be available). ``` function loadAdminScripts() { wp_register_style( 'admin-style', plugins_url('admin-style.css', __FILE__) ); wp_regis...
337,852
<p>I'm trying to fetch all my WooCommerce orders where some additional metadata is equal to not empty. </p> <pre><code>$orders = wc_get_orders( array( 'orderby' =&gt; 'date', 'order' =&gt; 'DESC', 'meta_query' =&gt; array( array( 'key' =&gt; 'var_rate', 'compare' =&gt;...
[ { "answer_id": 337865, "author": "Sally CJ", "author_id": 137402, "author_profile": "https://wordpress.stackexchange.com/users/137402", "pm_score": 3, "selected": false, "text": "<p>Apparently, WooCommerce is ignoring the <code>meta_query</code> parameter, so that's why you're getting al...
2019/05/14
[ "https://wordpress.stackexchange.com/questions/337852", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/115473/" ]
I'm trying to fetch all my WooCommerce orders where some additional metadata is equal to not empty. ``` $orders = wc_get_orders( array( 'orderby' => 'date', 'order' => 'DESC', 'meta_query' => array( array( 'key' => 'var_rate', 'compare' => 'NOT EXISTS', ) ...
The `meta_query` argument *(that you can use in a [`WP_Query`](https://codex.wordpress.org/Class_Reference/WP_Query))* is not enabled by default when using a [`WC_Order_Query`](https://github.com/woocommerce/woocommerce/wiki/wc_get_orders-and-WC_Order_Query) through [`wc_get_orders()`](https://docs.woocommerce.com/wc-a...
337,873
<p>Background of my problem: I'd like to mask external download links as internal links and to be only accessible by logged-in wp users at htaccess level or with PHP script but when redirection happens the visitor outside of wordpress can still access download links by pasting direct url into browser bar.</p> <p>I've ...
[ { "answer_id": 337865, "author": "Sally CJ", "author_id": 137402, "author_profile": "https://wordpress.stackexchange.com/users/137402", "pm_score": 3, "selected": false, "text": "<p>Apparently, WooCommerce is ignoring the <code>meta_query</code> parameter, so that's why you're getting al...
2019/05/14
[ "https://wordpress.stackexchange.com/questions/337873", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/167984/" ]
Background of my problem: I'd like to mask external download links as internal links and to be only accessible by logged-in wp users at htaccess level or with PHP script but when redirection happens the visitor outside of wordpress can still access download links by pasting direct url into browser bar. I've tried this...
The `meta_query` argument *(that you can use in a [`WP_Query`](https://codex.wordpress.org/Class_Reference/WP_Query))* is not enabled by default when using a [`WC_Order_Query`](https://github.com/woocommerce/woocommerce/wiki/wc_get_orders-and-WC_Order_Query) through [`wc_get_orders()`](https://docs.woocommerce.com/wc-a...
337,949
<p>I want to implement a system to insert custom links in my wordpress custom theme. I don't want to hardcode these links inside my theme. These links are for the socials or partners website. So they need to be easily changed from WordPress dashboard. I want to avoid registering a custom post type or using a post. Is t...
[ { "answer_id": 337865, "author": "Sally CJ", "author_id": 137402, "author_profile": "https://wordpress.stackexchange.com/users/137402", "pm_score": 3, "selected": false, "text": "<p>Apparently, WooCommerce is ignoring the <code>meta_query</code> parameter, so that's why you're getting al...
2019/05/15
[ "https://wordpress.stackexchange.com/questions/337949", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/168069/" ]
I want to implement a system to insert custom links in my wordpress custom theme. I don't want to hardcode these links inside my theme. These links are for the socials or partners website. So they need to be easily changed from WordPress dashboard. I want to avoid registering a custom post type or using a post. Is this...
The `meta_query` argument *(that you can use in a [`WP_Query`](https://codex.wordpress.org/Class_Reference/WP_Query))* is not enabled by default when using a [`WC_Order_Query`](https://github.com/woocommerce/woocommerce/wiki/wc_get_orders-and-WC_Order_Query) through [`wc_get_orders()`](https://docs.woocommerce.com/wc-a...
338,042
<p>Is there a way of loading a template file without having a post? I'm loading set of data via an API. Set up my index page but having a brain freeze with single template files as these posts are not in the WP registry/database.</p> <pre><code>// Template files events-index.php events-single.php </code></pre> <p>Eve...
[ { "answer_id": 338043, "author": "Alexander Holsgrove", "author_id": 48962, "author_profile": "https://wordpress.stackexchange.com/users/48962", "pm_score": 3, "selected": true, "text": "<p>You could setup a custom rewrite rule using <a href=\"https://developer.wordpress.org/reference/fu...
2019/05/16
[ "https://wordpress.stackexchange.com/questions/338042", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/97623/" ]
Is there a way of loading a template file without having a post? I'm loading set of data via an API. Set up my index page but having a brain freeze with single template files as these posts are not in the WP registry/database. ``` // Template files events-index.php events-single.php ``` Events index: ``` <?php $ev...
You could setup a custom rewrite rule using [add\_rewrite\_rule](https://developer.wordpress.org/reference/functions/add_rewrite_rule/) and send these requests to a custom page. Your URL structure could be `/index-page/single-event-slug` The rule would point all of the single events to a separate page where you can th...
338,050
<p>I work for an architecture company and our project names mostly go like this: <code>house|something</code>, <code>bridge|somewhere</code>, <code>building|whatever</code>.</p> <p>Now, when I want to add a new project named like that, WordPress automatically converts it to <code>housesomething</code>, <code>bridgesom...
[ { "answer_id": 338052, "author": "Michelle", "author_id": 16, "author_profile": "https://wordpress.stackexchange.com/users/16", "pm_score": 1, "selected": false, "text": "<p>If you put spaces in between the words and the separator | the permalink will automatically include dashes between...
2019/05/16
[ "https://wordpress.stackexchange.com/questions/338050", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/168163/" ]
I work for an architecture company and our project names mostly go like this: `house|something`, `bridge|somewhere`, `building|whatever`. Now, when I want to add a new project named like that, WordPress automatically converts it to `housesomething`, `bridgesomewhere` and puts that as the slug. I'd much prefer to keep ...
When WordPress [inserts a post](https://developer.wordpress.org/reference/functions/wp_insert_post/), it runs the title through a filter called [`sanitize_title`](https://developer.wordpress.org/reference/functions/sanitize_title/) to get the slug. By default there is a function called [`santize_title_with_dashes`](htt...
338,090
<p>How can I run a WP function on server cron?</p> <p>Background: I can't run it on wp_cron because the website is not published and will not be, so there will be no visitors. Tested cron job without wp function, it is working properly (like sending email every 30 minutes).</p> <pre><code>//RemoteCoins() and LoadRemo...
[ { "answer_id": 338052, "author": "Michelle", "author_id": 16, "author_profile": "https://wordpress.stackexchange.com/users/16", "pm_score": 1, "selected": false, "text": "<p>If you put spaces in between the words and the separator | the permalink will automatically include dashes between...
2019/05/17
[ "https://wordpress.stackexchange.com/questions/338090", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/167973/" ]
How can I run a WP function on server cron? Background: I can't run it on wp\_cron because the website is not published and will not be, so there will be no visitors. Tested cron job without wp function, it is working properly (like sending email every 30 minutes). ``` //RemoteCoins() and LoadRemoteCoins() that inclu...
When WordPress [inserts a post](https://developer.wordpress.org/reference/functions/wp_insert_post/), it runs the title through a filter called [`sanitize_title`](https://developer.wordpress.org/reference/functions/sanitize_title/) to get the slug. By default there is a function called [`santize_title_with_dashes`](htt...
338,108
<p>I’m trying to add HTML wrappers around a block to create a clipping effect, something like the below code. It has been suggested this might be possible with the block save or block edit functions?</p> <p>I have done a fair bit of experimenting with CSS clip-path and SVG clipPath and unfortunately they will not work...
[ { "answer_id": 338123, "author": "moped", "author_id": 160324, "author_profile": "https://wordpress.stackexchange.com/users/160324", "pm_score": 0, "selected": false, "text": "<p>You can create divs inside divs (or different elements) in the Gutenberg edit/save function. Like so: <br />...
2019/05/17
[ "https://wordpress.stackexchange.com/questions/338108", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/168211/" ]
I’m trying to add HTML wrappers around a block to create a clipping effect, something like the below code. It has been suggested this might be possible with the block save or block edit functions? I have done a fair bit of experimenting with CSS clip-path and SVG clipPath and unfortunately they will not work for what ...
When registering a block we indicate: an **edit** property which defines how the block acts/displays in the editor, and a **save** property which is responsible for the final HTML of the block. To modify these two functions from a block we need to use [filter hooks](https://developer.wordpress.org/block-editor/develop...
338,114
<p>I'm having trouble navigating the WP documentation so forgive me if this is common knowledge.</p> <p>Is it possible to view the documentation of classes and methods from within the shell?</p> <p>That is, is there a command that I can type at the <code>wp-shell</code> prompt that will return the api documentation f...
[ { "answer_id": 338122, "author": "leymannx", "author_id": 30597, "author_profile": "https://wordpress.stackexchange.com/users/30597", "pm_score": 1, "selected": false, "text": "<p>Skimming the available <a href=\"https://developer.wordpress.org/cli/commands/\" rel=\"nofollow noreferrer\"...
2019/05/17
[ "https://wordpress.stackexchange.com/questions/338114", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/74293/" ]
I'm having trouble navigating the WP documentation so forgive me if this is common knowledge. Is it possible to view the documentation of classes and methods from within the shell? That is, is there a command that I can type at the `wp-shell` prompt that will return the api documentation for a given method/class. So...
Skimming the available [WP-CLI commands](https://developer.wordpress.org/cli/commands/) I guess there is not something like that. You may create a feature request in the [WP-CLI GitHub repo](https://github.com/wp-cli/wp-cli) but I doubt that this will gain much attention without you explaining the actual necessity of s...
338,135
<p>I'm a working on editing a website done with wordpress and I want to change the copyright text in the footer but I can't find out how to do it because I'm a newbie.</p> <p><a href="https://i.stack.imgur.com/oCeUb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oCeUb.png" alt="enter image descript...
[ { "answer_id": 338137, "author": "davebrener", "author_id": 133156, "author_profile": "https://wordpress.stackexchange.com/users/133156", "pm_score": 0, "selected": false, "text": "<p>Have you tried looking in the Appearance>Widgets area? In my experience, sometimes the copyright text ca...
2019/05/17
[ "https://wordpress.stackexchange.com/questions/338135", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/168254/" ]
I'm a working on editing a website done with wordpress and I want to change the copyright text in the footer but I can't find out how to do it because I'm a newbie. [![enter image description here](https://i.stack.imgur.com/oCeUb.png)](https://i.stack.imgur.com/oCeUb.png) If you have some clues, I would be pleased to...
It all depends on the theme. Some themes require you to modify one of their files (specifically, the footer.php file, usually) to remove the text. If you go this route, you'd want to create/use a Child Theme so that a theme update doesn't overwrite your changes. Copy your theme's footer.php into your Child Theme folder...
338,152
<p>I am using something like this to query and display future or scheduled posts on my homepage:</p> <pre><code>&lt;?php query_posts('post_status=future&amp;posts_per_page=10&amp;order=ASC'); while ( have_posts() ) : the_post(); ?&gt; //doing stuff &lt;?php endwhile; ?&gt; &lt;?php wp_reset_query(); ?&gt; </code></p...
[ { "answer_id": 338155, "author": "Brendan Strong", "author_id": 153663, "author_profile": "https://wordpress.stackexchange.com/users/153663", "pm_score": 0, "selected": false, "text": "<p>Future and scheduled posts aren't considered published so you'd need to customize the queries in tho...
2019/05/17
[ "https://wordpress.stackexchange.com/questions/338152", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/86752/" ]
I am using something like this to query and display future or scheduled posts on my homepage: ``` <?php query_posts('post_status=future&posts_per_page=10&order=ASC'); while ( have_posts() ) : the_post(); ?> //doing stuff <?php endwhile; ?> <?php wp_reset_query(); ?> ``` This is working with great success. Although...
To achieve the intended result you will have to modify the query by adding the `future` value to the `post_status` parameter via the [`pre_get_posts`](https://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts) filter hook. ``` add_action( 'pre_get_posts', 'se338152_future_post_tag_and_search' ); function s...
338,159
<p>The WP loop goes like this:</p> <pre><code>if ( have_posts() ) { while ( have_posts() ) { the_post(); ... </code></pre> <p>Why is it preferred over the following?</p> <pre><code>foreach( (new WP_Query())-&gt;get_posts() as $post ) { ... } </code></pre> <p>To me, it's more apparent what is going on in t...
[ { "answer_id": 338161, "author": "Tom J Nowell", "author_id": 736, "author_profile": "https://wordpress.stackexchange.com/users/736", "pm_score": 5, "selected": true, "text": "<p>Several reasons</p>\n\n<h2>1. Filters and Actions</h2>\n\n<p>By using the standard loop, you execute various ...
2019/05/17
[ "https://wordpress.stackexchange.com/questions/338159", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/74293/" ]
The WP loop goes like this: ``` if ( have_posts() ) { while ( have_posts() ) { the_post(); ... ``` Why is it preferred over the following? ``` foreach( (new WP_Query())->get_posts() as $post ) { ... } ``` To me, it's more apparent what is going on in the latter. I'm new to PHP and WP and I'm trying to u...
Several reasons 1. Filters and Actions ---------------------- By using the standard loop, you execute various filters and actions that plugins rely on. Additionally, you set up `the_post` correctly, allowing functions such as `the_content` etc to work correctly. Some filters can even insert "posts" into the loop 2....
338,235
<p>How can I get <code>Pages</code> and <code>All Pages</code> ?? My code outputs <code>Pages</code> and <code>Pages</code>. My code is like below</p> <pre><code>add_menu_page( 'Pages', 'Pages', 'manage_options', 'Pages', 'page_callback_function', 'dashicons-media-spreadsheet', 26 ); </code></pre> <p><a href="https:...
[ { "answer_id": 338161, "author": "Tom J Nowell", "author_id": 736, "author_profile": "https://wordpress.stackexchange.com/users/736", "pm_score": 5, "selected": true, "text": "<p>Several reasons</p>\n\n<h2>1. Filters and Actions</h2>\n\n<p>By using the standard loop, you execute various ...
2019/05/19
[ "https://wordpress.stackexchange.com/questions/338235", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/104698/" ]
How can I get `Pages` and `All Pages` ?? My code outputs `Pages` and `Pages`. My code is like below ``` add_menu_page( 'Pages', 'Pages', 'manage_options', 'Pages', 'page_callback_function', 'dashicons-media-spreadsheet', 26 ); ``` [![enter image description here](https://i.stack.imgur.com/RlIv5.png)](https://i.stack...
Several reasons 1. Filters and Actions ---------------------- By using the standard loop, you execute various filters and actions that plugins rely on. Additionally, you set up `the_post` correctly, allowing functions such as `the_content` etc to work correctly. Some filters can even insert "posts" into the loop 2....
338,249
<p>Working within a Docker container (circleci/php:latest) and I'm struggling with wp-cli a bit. When I attempt to run <code>wp core install</code> I get a silent failure with 255 exit code. I enabled --debug hoping to get some more information but unfortunately all I can see is that it stops after reading wp-config.ph...
[ { "answer_id": 338256, "author": "leymannx", "author_id": 30597, "author_profile": "https://wordpress.stackexchange.com/users/30597", "pm_score": 0, "selected": false, "text": "<p>Ah! Now I just saw, that you are in a CircleCI container! I heavily rely on CircleCI containers for WordPres...
2019/05/20
[ "https://wordpress.stackexchange.com/questions/338249", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/168370/" ]
Working within a Docker container (circleci/php:latest) and I'm struggling with wp-cli a bit. When I attempt to run `wp core install` I get a silent failure with 255 exit code. I enabled --debug hoping to get some more information but unfortunately all I can see is that it stops after reading wp-config.php. ``` circle...
I was missing some php extensions that wp-cli and/or WordPress needed but there is no error output stating as much. I'm guessing it was specifically the missing mysqli extension. I used a [WP-CLI command](https://github.com/johnbillion/ext) to test the base container for missing extensions and now I have `sudo docker-...
338,250
<p>I got it to work with this:</p> <pre><code>$url = home_url( add_query_arg( array(), $wp-&gt;request ) ); </code></pre> <p>However, if the permalink is plain, all I'm getting is the homepage url (instead of the post url).</p> <p>So what's the best way to get the current post or page address link?</p>
[ { "answer_id": 338251, "author": "Derek Held", "author_id": 168370, "author_profile": "https://wordpress.stackexchange.com/users/168370", "pm_score": 1, "selected": false, "text": "<p>Is there a reason why <a href=\"https://developer.wordpress.org/reference/functions/get_permalink/\" rel...
2019/05/20
[ "https://wordpress.stackexchange.com/questions/338250", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/131331/" ]
I got it to work with this: ``` $url = home_url( add_query_arg( array(), $wp->request ) ); ``` However, if the permalink is plain, all I'm getting is the homepage url (instead of the post url). So what's the best way to get the current post or page address link?
Is there a reason why [get\_permalink()](https://developer.wordpress.org/reference/functions/get_permalink/) doesn't work for you? I'm unclear why you are trying to construct it manually.
338,280
<p>I'm trying to get rid of the function where users can hover over the main product image and zoom into the product. I tried using this code, which has been confirmed by others to work, but nothing changed.</p> <pre><code>function remove_image_zoom_support() { remove_theme_support( 'wc-product-gallery-zoom' ); } ...
[ { "answer_id": 338287, "author": "LoicTheAztec", "author_id": 79855, "author_profile": "https://wordpress.stackexchange.com/users/79855", "pm_score": 4, "selected": true, "text": "<p>This is possible using <code>woocommerce_single_product_zoom_enabled</code> dedicated filter hook:</p>\n\...
2019/05/20
[ "https://wordpress.stackexchange.com/questions/338280", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/18320/" ]
I'm trying to get rid of the function where users can hover over the main product image and zoom into the product. I tried using this code, which has been confirmed by others to work, but nothing changed. ``` function remove_image_zoom_support() { remove_theme_support( 'wc-product-gallery-zoom' ); } add_action( 'w...
This is possible using `woocommerce_single_product_zoom_enabled` dedicated filter hook: ``` add_filter( 'woocommerce_single_product_zoom_enabled', '__return_false' ); ``` Code goes in functions.php file of your active child theme (or active theme). Tested and work. --- It is possible using `woocommerce_single_prod...
338,281
<p>I think i'm probably doing something daft here. Every time i try to include this as a mu-plugin it takes down the test site though. </p> <pre><code>&lt;?php if( is_plugin_active( '/public_html/wp-content/plugins/wordfence.php' ) ) { require_once('wp-load.php'); $to = ‘myemail@gmail.com’; $subject = ‘Wor...
[ { "answer_id": 338282, "author": "MikeNGarrett", "author_id": 1670, "author_profile": "https://wordpress.stackexchange.com/users/1670", "pm_score": 2, "selected": false, "text": "<p>It's best to turn on <code>WP_DEBUG</code> to see exactly what problem you're facing. The code above inclu...
2019/05/20
[ "https://wordpress.stackexchange.com/questions/338281", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/168399/" ]
I think i'm probably doing something daft here. Every time i try to include this as a mu-plugin it takes down the test site though. ``` <?php if( is_plugin_active( '/public_html/wp-content/plugins/wordfence.php' ) ) { require_once('wp-load.php'); $to = ‘myemail@gmail.com’; $subject = ‘Wordfence is down’; ...
[`is_plugin_active`](https://codex.wordpress.org/Function_Reference/is_plugin_active) isn't available for mu-plugins to use. The codex says: > > NOTE: defined in wp-admin/includes/plugin.php, so this is only available from within the admin pages, and any references to this function must be hooked to admin\_init or a ...
338,288
<p>I have SSL certificate activated on my website. I did change the settings:</p> <pre><code>setting &gt; general </code></pre> <p>and edit <code>wp-config.php</code> to force HTTPS:</p> <pre><code>define( 'FORCE_SSL_ADMIN', true ); </code></pre> <p>The problem is, the redirect doesn't work and both versions of th...
[ { "answer_id": 338290, "author": "Nicolai Grossherr", "author_id": 22534, "author_profile": "https://wordpress.stackexchange.com/users/22534", "pm_score": 1, "selected": false, "text": "<p>Your rewrite conditions, line 4 to 6 in your code, apply when https is active, so you are redirecti...
2019/05/20
[ "https://wordpress.stackexchange.com/questions/338288", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/163748/" ]
I have SSL certificate activated on my website. I did change the settings: ``` setting > general ``` and edit `wp-config.php` to force HTTPS: ``` define( 'FORCE_SSL_ADMIN', true ); ``` The problem is, the redirect doesn't work and both versions of the site, HTTP and HTTPS, are accessible. I checked my `.htacces...
with adding this simple rules to your `.htacces`s file you can override any possible conflict with plugins and redirect issues don't forget to add these lines to the beginning of `.htaccess` ``` RewriteCond %{HTTP:CF-Visitor} '"scheme":"http"' RewriteRule ^(.*)$ https://www.example.com/$1 [L] ```
338,301
<p>Just installed the new 2019 theme. The customizer offers "default" and "custom" color options. When you select "custom", it shows a slider to pick the color, not the normal color-picker.</p> <p>Unfortunately, using that slider is pretty hit and miss and the customizer does not offer a way to enter a precise color (...
[ { "answer_id": 338318, "author": "leymannx", "author_id": 30597, "author_profile": "https://wordpress.stackexchange.com/users/30597", "pm_score": 3, "selected": true, "text": "<p>That's indeed an interesting question. Looking at the following issues - both closed as won't fix - I'd reaso...
2019/05/20
[ "https://wordpress.stackexchange.com/questions/338301", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/341/" ]
Just installed the new 2019 theme. The customizer offers "default" and "custom" color options. When you select "custom", it shows a slider to pick the color, not the normal color-picker. Unfortunately, using that slider is pretty hit and miss and the customizer does not offer a way to enter a precise color (hue). Whe...
That's indeed an interesting question. Looking at the following issues - both closed as won't fix - I'd reason that replacing this color slider with a color picker is not recommended: * <https://github.com/WordPress/twentynineteen/issues/613> * <https://core.trac.wordpress.org/ticket/45619> Thing is, that Twenty Nine...
338,306
<p>I am wanting to download themes from my localhost install of Wordpress. My issue is that anytime I click download, I get a pop-up asking me for Connection Information. </p> <p>I tried to input localhost and my Wordpress username and password, but it will not download. What step have I missed here?</p> <p><stron...
[ { "answer_id": 338325, "author": "Ted Stresen-Reuter", "author_id": 112766, "author_profile": "https://wordpress.stackexchange.com/users/112766", "pm_score": 0, "selected": false, "text": "<p>Try entering your system username and password. It sounds like you don't have permissions set co...
2019/05/20
[ "https://wordpress.stackexchange.com/questions/338306", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/102400/" ]
I am wanting to download themes from my localhost install of Wordpress. My issue is that anytime I click download, I get a pop-up asking me for Connection Information. I tried to input localhost and my Wordpress username and password, but it will not download. What step have I missed here? **edit** And I am runni...
Probably your local FTP service is not running. You can verify this by trying to connect to the local FTP server at the command prompt: ``` ftp localserver ``` and it will ask for your credentials. Also possible is that 'localserver' is not being resolved locally. You can check that with a command ``` nslookup loc...
338,336
<p>I have an html form in which I conditionally hide a field with javascript if an option is selected in the dropdown. The javascript condition works fine but when the page is reloaded the condition is lost even though the right option is still selected.</p> <p>Steps to recreate:</p> <ol> <li><p>I have a js code to s...
[ { "answer_id": 338366, "author": "Bhupen", "author_id": 128529, "author_profile": "https://wordpress.stackexchange.com/users/128529", "pm_score": 1, "selected": false, "text": "<p>Try this code:</p>\n\n<pre><code>// Conditionally show price\n(function ($) {\n window.onload = function() ...
2019/05/21
[ "https://wordpress.stackexchange.com/questions/338336", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/163105/" ]
I have an html form in which I conditionally hide a field with javascript if an option is selected in the dropdown. The javascript condition works fine but when the page is reloaded the condition is lost even though the right option is still selected. Steps to recreate: 1. I have a js code to store user input in sess...
Try this code: ``` // Conditionally show price (function ($) { window.onload = function() { if ($("#select_price_option").val() == "I need more information") { $('#price_input_div').hide(); } $("#select_price_option").change(function() { if ($(this).val() == "I need more information") { $('#price_inpu...
338,369
<p>I have defined <code>quote</code> post format for the theme:</p> <pre><code>// Add post-formats for theme add_theme_support( 'post-formats', array( 'quote', ) ); </code></pre> <p>After it, I want to display quote from the content. For that, I want to use <code>preg_match_all</code> function to search for <...
[ { "answer_id": 338366, "author": "Bhupen", "author_id": 128529, "author_profile": "https://wordpress.stackexchange.com/users/128529", "pm_score": 1, "selected": false, "text": "<p>Try this code:</p>\n\n<pre><code>// Conditionally show price\n(function ($) {\n window.onload = function() ...
2019/05/21
[ "https://wordpress.stackexchange.com/questions/338369", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/138428/" ]
I have defined `quote` post format for the theme: ``` // Add post-formats for theme add_theme_support( 'post-formats', array( 'quote', ) ); ``` After it, I want to display quote from the content. For that, I want to use `preg_match_all` function to search for `<blockquote>Hello World.</blockquote>` ``` if( ...
Try this code: ``` // Conditionally show price (function ($) { window.onload = function() { if ($("#select_price_option").val() == "I need more information") { $('#price_input_div').hide(); } $("#select_price_option").change(function() { if ($(this).val() == "I need more information") { $('#price_inpu...
338,383
<p>I'd like to disable access to posts in the back-end/Admin from a user that doesn't have the privilege to view those posts. This will function similar to the Author role however this "privilege" is controlled by an <a href="https://advancedcustomfields.com" rel="nofollow noreferrer">ACF</a> User relationship field an...
[ { "answer_id": 338387, "author": "Welcher", "author_id": 27210, "author_profile": "https://wordpress.stackexchange.com/users/27210", "pm_score": 1, "selected": false, "text": "<p>Your best bet is to use the <code>pre_get_posts</code> hook to adjust the query on the admin side.</p>\n\n<p>...
2019/05/21
[ "https://wordpress.stackexchange.com/questions/338383", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2080/" ]
I'd like to disable access to posts in the back-end/Admin from a user that doesn't have the privilege to view those posts. This will function similar to the Author role however this "privilege" is controlled by an [ACF](https://advancedcustomfields.com) User relationship field and not by a WP Core role or privilege. O...
Your best bet is to use the `pre_get_posts` hook to adjust the query on the admin side. Your logic is pretty complicated so I won't try to give you a working example but the snippet below will get you started. Basically, you want to be sure your in the admin and managing the main query. [Codex link](https://codex.wor...
338,390
<p>What happen when a post (product) didnt have a guid,because it has the same image with another product ? </p> <p>For example:</p> <p>Query1: </p> <pre><code>select guid from wp_posts where post_type='attachment' and post_parent=num </code></pre> <p>Returns nothing.</p> <p>Query2: </p> <pre><code>select guid f...
[ { "answer_id": 338397, "author": "Jacob Peattie", "author_id": 39152, "author_profile": "https://wordpress.stackexchange.com/users/39152", "pm_score": 4, "selected": false, "text": "<p>Firstly, the GUID is not the URL. It is a \"globally unique identifier\". WordPress uses the URL for th...
2019/05/21
[ "https://wordpress.stackexchange.com/questions/338390", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/168479/" ]
What happen when a post (product) didnt have a guid,because it has the same image with another product ? For example: Query1: ``` select guid from wp_posts where post_type='attachment' and post_parent=num ``` Returns nothing. Query2: ``` select guid from wp_posts where ID=num ``` Returns the url of product...
Firstly, the GUID is not the URL. It is a "globally unique identifier". WordPress uses the URL for this purpose, but accessing it is not a reliable way to get the URL for anything (this was a bad idea, but is kept this way for backwards compatibility). It's not possible to query the image URL from the database directl...
338,394
<p>I want to remove the editor and set up only the excerpt to a custom product type (WooCommerce) in my theme, is this possible?</p> <p>This is how i add my custom product type to the WooCommerce product type selector</p> <pre><code>&lt;?php defined('ABSPATH') || exit; class Custom_Product_Type(){ public functio...
[ { "answer_id": 338396, "author": "Deepak Singh", "author_id": 138263, "author_profile": "https://wordpress.stackexchange.com/users/138263", "pm_score": 1, "selected": false, "text": "<p>Yes, You can disable the default editor by removing <strong>'editor'</strong> from the supports attrib...
2019/05/21
[ "https://wordpress.stackexchange.com/questions/338394", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/130208/" ]
I want to remove the editor and set up only the excerpt to a custom product type (WooCommerce) in my theme, is this possible? This is how i add my custom product type to the WooCommerce product type selector ``` <?php defined('ABSPATH') || exit; class Custom_Product_Type(){ public function __construct() { ...
I've figured how to hide the editor only when the product type is selected because if i remove the support: 1) The product type is the hidden and then change the product type to another the editor doesn't appear back 2) The product type is not the hidden and then change the product type to hidden the editor dont diss...
338,398
<p>I made some research and found a way how to create custom pages using content (post) types. However, I do not want to create a new post type, I just want to create a page having a certain URL (<code>/form</code>) with a form on it. I was not able to find how to do it without custom post types. Can someone show me th...
[ { "answer_id": 338403, "author": "bjornredemption", "author_id": 64380, "author_profile": "https://wordpress.stackexchange.com/users/64380", "pm_score": 0, "selected": false, "text": "<p>Install a form plugin. Contact form 7 is a good one :\n <a href=\"https://en-au.wordpress.org/plugins...
2019/05/21
[ "https://wordpress.stackexchange.com/questions/338398", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/168483/" ]
I made some research and found a way how to create custom pages using content (post) types. However, I do not want to create a new post type, I just want to create a page having a certain URL (`/form`) with a form on it. I was not able to find how to do it without custom post types. Can someone show me the correct dire...
You can use **wp\_insert\_post()** function with '**after\_theme\_setup**' action hook to programatically create pages. Here is a short example, ``` add_action( 'after_setup_theme', 'create_form_page' ); function create_form_page(){ $title = 'Form'; $slug = 'form'; $page_content = ''; // your page content...
338,427
<p>I want to make a dynamic select where the user will put state, there will appear the cities of this state, then will put city and will appear the universities of this city for him to choose, how can I do this? I've done this in php, but the code I used in php does not work inside the function to add in the field of ...
[ { "answer_id": 338404, "author": "Ted Stresen-Reuter", "author_id": 112766, "author_profile": "https://wordpress.stackexchange.com/users/112766", "pm_score": 0, "selected": false, "text": "<p>The native WordPress commenting system, without checks of any kind, is very likely a bad idea. H...
2019/05/21
[ "https://wordpress.stackexchange.com/questions/338427", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/168493/" ]
I want to make a dynamic select where the user will put state, there will appear the cities of this state, then will put city and will appear the universities of this city for him to choose, how can I do this? I've done this in php, but the code I used in php does not work inside the function to add in the field of woo...
WordPress default settings are to allow anyone to comment as long as they leave a name and email. Emails aren't verified, so you could use someone else's email and gravatar and the comment would be published. Best practice is to verify the email address of the user making the comment. In WordPress core functionality,...
338,429
<p>I wanna remove the functionality of when you click on a order row in Orders in Admin, you will be sent to the edit page for that order. </p> <p>I know it's added with jQuery in a js-file in the WooCommerce plugin. I have located the actual code:</p> <pre><code>/** * Click a row. */ WCOrdersTable.prototype.onRowC...
[ { "answer_id": 338514, "author": "Antti Koskinen", "author_id": 144392, "author_profile": "https://wordpress.stackexchange.com/users/144392", "pm_score": 2, "selected": true, "text": "<p>Based on <a href=\"https://github.com/woocommerce/woocommerce/blob/master/includes/admin/list-tables/...
2019/05/21
[ "https://wordpress.stackexchange.com/questions/338429", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3216/" ]
I wanna remove the functionality of when you click on a order row in Orders in Admin, you will be sent to the edit page for that order. I know it's added with jQuery in a js-file in the WooCommerce plugin. I have located the actual code: ``` /** * Click a row. */ WCOrdersTable.prototype.onRowClick = function( e ) ...
Based on [`class-wc-admin-list-table-orders.php`](https://github.com/woocommerce/woocommerce/blob/master/includes/admin/list-tables/class-wc-admin-list-table-orders.php) ([order column on line 173](https://github.com/woocommerce/woocommerce/blob/master/includes/admin/list-tables/class-wc-admin-list-table-orders.php#L17...
338,492
<p>I created a custom login page and everything is OK but there is an issue. I want to redirect users to different pages based on their roles after login. My code is below but I do not know why it is not working:</p> <pre><code> if (!$has_error) { $info = array(); $info['user_login'] = $...
[ { "answer_id": 338497, "author": "Rafiq", "author_id": 141331, "author_profile": "https://wordpress.stackexchange.com/users/141331", "pm_score": 2, "selected": false, "text": "<p>Try this. It works for me.</p>\n\n<pre><code>add_filter( 'login_redirect', 'redirect_non_admin_to_dashboard')...
2019/05/22
[ "https://wordpress.stackexchange.com/questions/338492", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/157522/" ]
I created a custom login page and everything is OK but there is an issue. I want to redirect users to different pages based on their roles after login. My code is below but I do not know why it is not working: ``` if (!$has_error) { $info = array(); $info['user_login'] = $user_login; ...
i found the answer myself. i used `wp_get_current_user()` while `wp_get_current_user()` may not be set at this step then i tried the `user_can` with `$user_signon` that i defined before for user login. so the new codes: ``` if( user_can($user_signon, 'author') ){ $redirect = site_url().'/pishkha...
338,526
<p>I have a server (server 1) which send requests to another server (server 2) where WordPress is installed and I am using their (server 2) WP REST API. </p> <p>The problem is that I can't create/send <code>wp-nonce</code> from server 1 to server 2, and I am getting the following response:</p> <pre><code>{ "code": "r...
[ { "answer_id": 338532, "author": "John Swaringen", "author_id": 723, "author_profile": "https://wordpress.stackexchange.com/users/723", "pm_score": 1, "selected": false, "text": "<p>Try adding the following to your theme's functions.php file at the top. This will allow you to use Cross ...
2019/05/22
[ "https://wordpress.stackexchange.com/questions/338526", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/152132/" ]
I have a server (server 1) which send requests to another server (server 2) where WordPress is installed and I am using their (server 2) WP REST API. The problem is that I can't create/send `wp-nonce` from server 1 to server 2, and I am getting the following response: ``` { "code": "rest_not_logged_in", "message": "...
Since your specific scenario is a remote application making a request to WordPress you'll need to explore [additional authentication methods available via plugins](https://developer.wordpress.org/rest-api/using-the-rest-api/authentication/#authentication-plugins) for the REST API. I won't make any specific recommendati...
338,531
<p>I am trying to upload base 64 encoded images to my website media library via API. API returns with image ID but these images are displaying as blank images in my media library. Here is my code </p> <pre><code>add_action('rest_api_init', function () { register_rest_route( 'api/v1', 'upload_image/',array( 'meth...
[ { "answer_id": 338606, "author": "Sally CJ", "author_id": 137402, "author_profile": "https://wordpress.stackexchange.com/users/137402", "pm_score": 1, "selected": false, "text": "<p>You should generate the attachment metadata such as width and height &mdash; and file path, and also thumb...
2019/05/22
[ "https://wordpress.stackexchange.com/questions/338531", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/120693/" ]
I am trying to upload base 64 encoded images to my website media library via API. API returns with image ID but these images are displaying as blank images in my media library. Here is my code ``` add_action('rest_api_init', function () { register_rest_route( 'api/v1', 'upload_image/',array( 'methods' => 'POST...
This function worked for me finally. ``` function accept_image($request){ error_reporting(E_ALL); //Image should be set as the body of the POST request, as a base-64 encoded string. //It should NOT include decorations such as data:image/png;base64, at the beginning. It should only be the encoded file itself. //...