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 |
|---|---|---|---|---|---|---|
320,377 | <p>I want to run my own JavaScript on a specific WordPress page but only after a third party's plugin runs as I am trying to slightly modify that plugin. My problem is that my JavaScript is running before, not after, the plugin's script. Is my mistake in how I am referring to the plugin's script (i.e. the dependent s... | [
{
"answer_id": 320384,
"author": "RiddleMeThis",
"author_id": 86845,
"author_profile": "https://wordpress.stackexchange.com/users/86845",
"pm_score": -1,
"selected": true,
"text": "<p>Try this...</p>\n\n<pre><code>function load_new_js() {\n if( is_page( 692 ) ) {\n wp_enqueue_s... | 2018/11/27 | [
"https://wordpress.stackexchange.com/questions/320377",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/154831/"
] | I want to run my own JavaScript on a specific WordPress page but only after a third party's plugin runs as I am trying to slightly modify that plugin. My problem is that my JavaScript is running before, not after, the plugin's script. Is my mistake in how I am referring to the plugin's script (i.e. the dependent script... | Try this...
```
function load_new_js() {
if( is_page( 692 ) ) {
wp_enqueue_script(
'modify_plugin_js',
get_stylesheet_directory_uri() . '/mycustomscript.js',
array('jquery','greetingnow')
);
}
}
```
If that doesn't work, what plugin are you using? |
320,417 | <p>Im using wp_insert_post to add products on the front end of a woocommerces site</p>
<p>My current code will upload all the images but only the last image will be in the product gallery images</p>
<p>heres my code;</p>
<p>functions.php</p>
<pre><code>function my_handle_attachment( $file_handler, $post_id, $set_th... | [
{
"answer_id": 320384,
"author": "RiddleMeThis",
"author_id": 86845,
"author_profile": "https://wordpress.stackexchange.com/users/86845",
"pm_score": -1,
"selected": true,
"text": "<p>Try this...</p>\n\n<pre><code>function load_new_js() {\n if( is_page( 692 ) ) {\n wp_enqueue_s... | 2018/11/28 | [
"https://wordpress.stackexchange.com/questions/320417",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/140870/"
] | Im using wp\_insert\_post to add products on the front end of a woocommerces site
My current code will upload all the images but only the last image will be in the product gallery images
heres my code;
functions.php
```
function my_handle_attachment( $file_handler, $post_id, $set_thu=false) {
// check to make sur... | Try this...
```
function load_new_js() {
if( is_page( 692 ) ) {
wp_enqueue_script(
'modify_plugin_js',
get_stylesheet_directory_uri() . '/mycustomscript.js',
array('jquery','greetingnow')
);
}
}
```
If that doesn't work, what plugin are you using? |
320,448 | <p>I am wondering if the below logic is correct and if certain circumstances should be present for it to work, since in some cases it does not seem to be working. </p>
<p>The example below is quite simple. Let's say that I want to use a function, that is defined elsewhere in a theme-related file, let's say <code>paren... | [
{
"answer_id": 320384,
"author": "RiddleMeThis",
"author_id": 86845,
"author_profile": "https://wordpress.stackexchange.com/users/86845",
"pm_score": -1,
"selected": true,
"text": "<p>Try this...</p>\n\n<pre><code>function load_new_js() {\n if( is_page( 692 ) ) {\n wp_enqueue_s... | 2018/11/28 | [
"https://wordpress.stackexchange.com/questions/320448",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/124244/"
] | I am wondering if the below logic is correct and if certain circumstances should be present for it to work, since in some cases it does not seem to be working.
The example below is quite simple. Let's say that I want to use a function, that is defined elsewhere in a theme-related file, let's say `parent_theme_hooks.p... | Try this...
```
function load_new_js() {
if( is_page( 692 ) ) {
wp_enqueue_script(
'modify_plugin_js',
get_stylesheet_directory_uri() . '/mycustomscript.js',
array('jquery','greetingnow')
);
}
}
```
If that doesn't work, what plugin are you using? |
320,497 | <p>Within a single post I show all tags of the specific post by using this:</p>
<pre><code>the_tags( $tags_opening, ' ', $tags_ending );
</code></pre>
<p>But sometimes I mark a post with a tag that should not appear on that single page (but this tag shall still be found on - for example - an overview page with all ta... | [
{
"answer_id": 320506,
"author": "Nicolai Grossherr",
"author_id": 22534,
"author_profile": "https://wordpress.stackexchange.com/users/22534",
"pm_score": 0,
"selected": false,
"text": "<p>You can use <a href=\"https://developer.wordpress.org/reference/functions/get_terms/\" rel=\"nofoll... | 2018/11/28 | [
"https://wordpress.stackexchange.com/questions/320497",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | Within a single post I show all tags of the specific post by using this:
```
the_tags( $tags_opening, ' ', $tags_ending );
```
But sometimes I mark a post with a tag that should not appear on that single page (but this tag shall still be found on - for example - an overview page with all tags).
How can I exclude sp... | Not sure that this is the best decision, but you can use the filter to cut your special tag without modifying templates.
```
add_filter('the_tags', 'wpse_320497_the_tags');
function wpse_320497_the_tags($tags) {
$exclude_tag = 'word';
// You can add your own conditions here
// For example, exclude specif... |
320,505 | <p>I have this function...</p>
<pre><code>$user = wp_get_current_user();
if (( in_category('Locked') ) && in_array( 'subscriber', (array) $user->roles ) ) {
/* Is subscriber, is in category Locked, has amount of posts */
echo do_shortcode('[shortcode_name]');
} else if (( in_category('Locked') ) &a... | [
{
"answer_id": 320507,
"author": "Krzysiek Dróżdż",
"author_id": 34172,
"author_profile": "https://wordpress.stackexchange.com/users/34172",
"pm_score": 3,
"selected": true,
"text": "<p>I guess <a href=\"https://codex.wordpress.org/Function_Reference/count_user_posts\" rel=\"nofollow nor... | 2018/11/28 | [
"https://wordpress.stackexchange.com/questions/320505",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/113798/"
] | I have this function...
```
$user = wp_get_current_user();
if (( in_category('Locked') ) && in_array( 'subscriber', (array) $user->roles ) ) {
/* Is subscriber, is in category Locked, has amount of posts */
echo do_shortcode('[shortcode_name]');
} else if (( in_category('Locked') ) && in_array( 'subscriber', ... | I guess [`count_user_posts`](https://codex.wordpress.org/Function_Reference/count_user_posts) is what you're looking for ;)
This is how you use it:
```
$user_post_count = count_user_posts( $userid , $post_type );
```
And it returns the number of published posts the user has written in this post type.
PS. And if yo... |
320,538 | <p>I try to apply a check figuring out if a plugin is either not active or just not installed at all in the plugin directory. When I test I check for a plugin installed but not activated as seen in the screenshot. </p>
<p><a href="https://i.stack.imgur.com/qdEYn.png" rel="nofollow noreferrer"><img src="https://i.stack... | [
{
"answer_id": 320541,
"author": "Jacob Peattie",
"author_id": 39152,
"author_profile": "https://wordpress.stackexchange.com/users/39152",
"pm_score": 4,
"selected": true,
"text": "<p><code>file_exists</code> expects a <em>path</em>, not a URL. To get the path to an arbitrary plugin you'... | 2018/11/29 | [
"https://wordpress.stackexchange.com/questions/320538",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/44742/"
] | I try to apply a check figuring out if a plugin is either not active or just not installed at all in the plugin directory. When I test I check for a plugin installed but not activated as seen in the screenshot.
[![VSCode screen showing sidebar with the installed plugin and the editor screen with the code from underne... | `file_exists` expects a *path*, not a URL. To get the path to an arbitrary plugin you'll need to use `WP_PLUGIN_DIR`:
```
$pathpluginurl = WP_PLUGIN_DIR . '/advanced-custom-fields/acf.php';
$isinstalled = file_exists( $pathpluginurl );
``` |
320,547 | <p>I’ve got a question. Maybe it’s something existing and I don’t know the name. Or maybe it’s something custom.</p>
<p>I’ve got a post type for news. The news posts have categories.
These are some examples of separate news items</p>
<ul>
<li><p>News item 1.</p>
<ul>
<li>Category “purple”</li>
</ul></li>
<li><p>News... | [
{
"answer_id": 320541,
"author": "Jacob Peattie",
"author_id": 39152,
"author_profile": "https://wordpress.stackexchange.com/users/39152",
"pm_score": 4,
"selected": true,
"text": "<p><code>file_exists</code> expects a <em>path</em>, not a URL. To get the path to an arbitrary plugin you'... | 2018/11/29 | [
"https://wordpress.stackexchange.com/questions/320547",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/152589/"
] | I’ve got a question. Maybe it’s something existing and I don’t know the name. Or maybe it’s something custom.
I’ve got a post type for news. The news posts have categories.
These are some examples of separate news items
* News item 1.
+ Category “purple”
* News item 2.
+ Category “purple”
+ Category “red”
* News... | `file_exists` expects a *path*, not a URL. To get the path to an arbitrary plugin you'll need to use `WP_PLUGIN_DIR`:
```
$pathpluginurl = WP_PLUGIN_DIR . '/advanced-custom-fields/acf.php';
$isinstalled = file_exists( $pathpluginurl );
``` |
320,570 | <p>When inserting a core/paragraph block to the content, we can choose e.g. "bold", "add link" from the controls above the content:</p>
<p><a href="https://i.stack.imgur.com/3oG6s.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3oG6s.png" alt="enter image description here"></a></p>
<p>For my custom... | [
{
"answer_id": 323274,
"author": "Fergus Bisset",
"author_id": 142589,
"author_profile": "https://wordpress.stackexchange.com/users/142589",
"pm_score": 1,
"selected": false,
"text": "<p>If I understand your requirements correctly, and assuming you haven't now discovered this already, th... | 2018/11/29 | [
"https://wordpress.stackexchange.com/questions/320570",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/40821/"
] | When inserting a core/paragraph block to the content, we can choose e.g. "bold", "add link" from the controls above the content:
[](https://i.stack.imgur.com/3oG6s.png)
For my customer, I would like to add formatting buttons for `<sup></sup>` and `<s... | An official tutorial to add custom buttons is now available [here](https://github.com/WordPress/gutenberg/tree/master/docs/designers-developers/developers/tutorials/format-api). |
320,579 | <p>I'm trying to set up, when a specific page/url is visited that a cookie is set and saved.</p>
<p>So far I've tried this:</p>
<pre><code>add_action('init', 'set_cookie', 1);
function set_cookie(){
if ( $currentURL == 'https://25dni.si/delovanje-uma/' ) :
if ( ! isset( $_COOKIE['opt_in'] ) ) :
setco... | [
{
"answer_id": 320597,
"author": "jdp",
"author_id": 115910,
"author_profile": "https://wordpress.stackexchange.com/users/115910",
"pm_score": 0,
"selected": false,
"text": "<p>I'm surprised it works at all since <code>$currentURL</code> is not defined in the function nor declared as a g... | 2018/11/29 | [
"https://wordpress.stackexchange.com/questions/320579",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/154962/"
] | I'm trying to set up, when a specific page/url is visited that a cookie is set and saved.
So far I've tried this:
```
add_action('init', 'set_cookie', 1);
function set_cookie(){
if ( $currentURL == 'https://25dni.si/delovanje-uma/' ) :
if ( ! isset( $_COOKIE['opt_in'] ) ) :
setcookie( 'opt_in', has_o... | I've used this and it works:
```
add_action('init', 'optin_cookie', 1);
function optin_cookie(){
$currentURL = "https://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
if ( $currentURL == 'https://25dni.si/delovanje-uma/' ) :
setcookie( 'opt_in', has_opt_in, time()+31556926, '/');
elseif ( $cu... |
320,599 | <p>I want to sort posts by a meta value in a custom field. Basically I've added a field called 'date_event' and want to sort the posts by that date (stored as YYYYMMMDD).</p>
<p>The only working example I have is this placed in the loop.php:</p>
<pre><code>$query = new WP_Query(
array(
'meta_key' => '... | [
{
"answer_id": 320591,
"author": "RiddleMeThis",
"author_id": 86845,
"author_profile": "https://wordpress.stackexchange.com/users/86845",
"pm_score": 1,
"selected": false,
"text": "<p>I have used <a href=\"https://wordpress.org/plugins/polylang/\" rel=\"nofollow noreferrer\">Polyang</a> ... | 2018/11/29 | [
"https://wordpress.stackexchange.com/questions/320599",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/154977/"
] | I want to sort posts by a meta value in a custom field. Basically I've added a field called 'date\_event' and want to sort the posts by that date (stored as YYYYMMMDD).
The only working example I have is this placed in the loop.php:
```
$query = new WP_Query(
array(
'meta_key' => 'date_event',
'... | I have used [Polyang](https://wordpress.org/plugins/polylang/) in the past which works nicely for manual translations. Here is a [guide](https://www.wpbeginner.com/beginners-guide/how-to-easily-create-a-multilingual-wordpress-site/) that covers it. |
320,600 | <p>Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'wp_my_admin_enqueue_scripts' not found or invalid function name in /mnt/data/vhosts/casite-961871.cloudaccess.net/httpdocs/wp-includes/class-wp-hook.php on line 286</p>
| [
{
"answer_id": 320603,
"author": "jdm2112",
"author_id": 45202,
"author_profile": "https://wordpress.stackexchange.com/users/45202",
"pm_score": 2,
"selected": false,
"text": "<p>This means you have a function named <code>wp_my_admin_enqueue_scripts</code> hooked to an action, either in ... | 2018/11/29 | [
"https://wordpress.stackexchange.com/questions/320600",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/154979/"
] | Warning: call\_user\_func\_array() expects parameter 1 to be a valid callback, function 'wp\_my\_admin\_enqueue\_scripts' not found or invalid function name in /mnt/data/vhosts/casite-961871.cloudaccess.net/httpdocs/wp-includes/class-wp-hook.php on line 286 | This means you have a function named `wp_my_admin_enqueue_scripts` hooked to an action, either in your theme or a plugin, but that function name is not available to WordPress for some reason.
When that action fires, any functions "hooked" to it are executed by WordPress. If one of the hooked functions is not available... |
320,616 | <p>I just took over a website created with wordpress but is broken, the hosting provider reinstalled wordpress but kept the database, so all the information is there, however i can see that the code for the pages seems to have been generated by using some plugin or similar, so now I don't have information of which plug... | [
{
"answer_id": 320618,
"author": "Rick Hellewell",
"author_id": 29416,
"author_profile": "https://wordpress.stackexchange.com/users/29416",
"pm_score": 0,
"selected": false,
"text": "<p>Plugins add additional functionality to a site. Page code is generated by the theme's templates, which... | 2018/11/30 | [
"https://wordpress.stackexchange.com/questions/320616",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/154996/"
] | I just took over a website created with wordpress but is broken, the hosting provider reinstalled wordpress but kept the database, so all the information is there, however i can see that the code for the pages seems to have been generated by using some plugin or similar, so now I don't have information of which plugins... | I found the plugin by running a search for the string "text\_dd" in the `wp-content/plugins/` directory.
Looks like this specific plugin (which provides `text_dd`, `column_dd` and `section_dd` shortcodes) is called "dnd-shortcodes" and contains the following snippet of information:
```none
Plugin Name: Drag and Drop ... |
320,653 | <p>The new editor called Gutenberg is here as plugin in 4.9, and as core functionality called Block Editor, in 5.0. Regarding to it, it is often needed to determine programmatically which editor is used to edit post or page in the site console. How to do it?</p>
<p><strong>Update:</strong> There are number of outdated... | [
{
"answer_id": 320654,
"author": "KAGG Design",
"author_id": 108721,
"author_profile": "https://wordpress.stackexchange.com/users/108721",
"pm_score": 5,
"selected": true,
"text": "<p>There are several variants:</p>\n\n<ul>\n<li>WordPress 4.9, Gutenberg plugin is not active</li>\n<li>Wor... | 2018/11/30 | [
"https://wordpress.stackexchange.com/questions/320653",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/108721/"
] | The new editor called Gutenberg is here as plugin in 4.9, and as core functionality called Block Editor, in 5.0. Regarding to it, it is often needed to determine programmatically which editor is used to edit post or page in the site console. How to do it?
**Update:** There are number of outdated answers to similar que... | There are several variants:
* WordPress 4.9, Gutenberg plugin is not active
* WordPress 4.9, Gutenberg plugin is active
* WordPress 5.0, Block Editor by default
* WordPress 5.0, Classic Editor plugin is active
* WordPress 5.0, Classic Editor plugin is active, but in site console in “Settings > Writing” the option “Use... |
320,656 | <p>I set cookie for my users to know from which source they come to the site and I want when user contact us their message comes with their cookie as well.</p>
<p>So that I created a new shortcode and added in mail section but it mails direct shortcode not its returned value</p>
<p>Code :</p>
<pre><code>function my_... | [
{
"answer_id": 320658,
"author": "Sally CJ",
"author_id": 137402,
"author_profile": "https://wordpress.stackexchange.com/users/137402",
"pm_score": 3,
"selected": true,
"text": "<p>You should do it like so:</p>\n\n<pre><code>add_action( 'wpcf7_init', 'custom_add_form_tag_my_source' );\n\... | 2018/11/30 | [
"https://wordpress.stackexchange.com/questions/320656",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8184/"
] | I set cookie for my users to know from which source they come to the site and I want when user contact us their message comes with their cookie as well.
So that I created a new shortcode and added in mail section but it mails direct shortcode not its returned value
Code :
```
function my_shortcode( $atts ) {
retu... | You should do it like so:
```
add_action( 'wpcf7_init', 'custom_add_form_tag_my_source' );
function custom_add_form_tag_my_source() {
// "my-source" is the type of the form-tag
wpcf7_add_form_tag( 'my-source', 'custom_my_source_form_tag_handler' );
}
function custom_my_source_form_tag_handler( $tag ) {
return ... |
320,690 | <p>I'd like to update my post status (of my own CPT) based on custom field "played". If played is 1 i want that the post shall be published, but if the custom field played is 0 the post shall be draft also if I tried to publish it.</p>
<p>Is it possible?</p>
<p>I tried to search in the forum but nothing found that wo... | [
{
"answer_id": 320691,
"author": "JakeParis",
"author_id": 2044,
"author_profile": "https://wordpress.stackexchange.com/users/2044",
"pm_score": 1,
"selected": false,
"text": "<p>That might be quite a bit of code to paste in here, but your strategy should be along the lines of: </p>\n\n<... | 2018/11/30 | [
"https://wordpress.stackexchange.com/questions/320690",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/134550/"
] | I'd like to update my post status (of my own CPT) based on custom field "played". If played is 1 i want that the post shall be published, but if the custom field played is 0 the post shall be draft also if I tried to publish it.
Is it possible?
I tried to search in the forum but nothing found that works... also tried... | All you need to do is to use [`save_post`](https://codex.wordpress.org/Plugin_API/Action_Reference/save_post) hook. Here's how:
```
function change_post_status_based_on_custom_field( $post_id ) {
// If this is just a revision, don't do anything.
if ( wp_is_post_revision( $post_id ) )
return;
// Ge... |
320,695 | <p>I am trying to get the featured image of a post using the WordPress REST API. I am adding the extention of ?embed to the end if the REST API url and I am seeing the featured image data under ['wp:featuredmedia'], but I can't seem to display that data. </p>
<p>I am using Vue to display data from the REST API and so ... | [
{
"answer_id": 320691,
"author": "JakeParis",
"author_id": 2044,
"author_profile": "https://wordpress.stackexchange.com/users/2044",
"pm_score": 1,
"selected": false,
"text": "<p>That might be quite a bit of code to paste in here, but your strategy should be along the lines of: </p>\n\n<... | 2018/11/30 | [
"https://wordpress.stackexchange.com/questions/320695",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/153404/"
] | I am trying to get the featured image of a post using the WordPress REST API. I am adding the extention of ?embed to the end if the REST API url and I am seeing the featured image data under ['wp:featuredmedia'], but I can't seem to display that data.
I am using Vue to display data from the REST API and so what I am ... | All you need to do is to use [`save_post`](https://codex.wordpress.org/Plugin_API/Action_Reference/save_post) hook. Here's how:
```
function change_post_status_based_on_custom_field( $post_id ) {
// If this is just a revision, don't do anything.
if ( wp_is_post_revision( $post_id ) )
return;
// Ge... |
320,751 | <p>Ok, I know similar questions have been asked before but none of the answers I found seem to work. Here's my code:</p>
<pre><code>$sql = $wpdb->prepare('SELECT ID FROM ' . $ignore_url_table_name . " where url LIKE '%%%s%%'", $urlRequested);
$wpdb->get_row($sql);
if ($wpdb->num_rows > 0) {
return;
}
... | [
{
"answer_id": 320691,
"author": "JakeParis",
"author_id": 2044,
"author_profile": "https://wordpress.stackexchange.com/users/2044",
"pm_score": 1,
"selected": false,
"text": "<p>That might be quite a bit of code to paste in here, but your strategy should be along the lines of: </p>\n\n<... | 2018/12/01 | [
"https://wordpress.stackexchange.com/questions/320751",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/155077/"
] | Ok, I know similar questions have been asked before but none of the answers I found seem to work. Here's my code:
```
$sql = $wpdb->prepare('SELECT ID FROM ' . $ignore_url_table_name . " where url LIKE '%%%s%%'", $urlRequested);
$wpdb->get_row($sql);
if ($wpdb->num_rows > 0) {
return;
}
```
Here's the problem: I... | All you need to do is to use [`save_post`](https://codex.wordpress.org/Plugin_API/Action_Reference/save_post) hook. Here's how:
```
function change_post_status_based_on_custom_field( $post_id ) {
// If this is just a revision, don't do anything.
if ( wp_is_post_revision( $post_id ) )
return;
// Ge... |
320,781 | <p>I want to apply the AJAX feature to the WordPress custom theme for search. And I need to target the input using id and class.</p>
<p>I didn't find any tutorial on adding id to the premade WordPress search form. Remember you, I am talking about the <strong>get_search_form()</strong> function. </p>
<p>I want to modi... | [
{
"answer_id": 320789,
"author": "Maqk",
"author_id": 86885,
"author_profile": "https://wordpress.stackexchange.com/users/86885",
"pm_score": 3,
"selected": true,
"text": "<p>You can hook into the <code>get_search_form()</code>. Set the priority high enough to override anything created i... | 2018/12/02 | [
"https://wordpress.stackexchange.com/questions/320781",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/149333/"
] | I want to apply the AJAX feature to the WordPress custom theme for search. And I need to target the input using id and class.
I didn't find any tutorial on adding id to the premade WordPress search form. Remember you, I am talking about the **get\_search\_form()** function.
I want to modify its input and want to add... | You can hook into the `get_search_form()`. Set the priority high enough to override anything created in a theme. If you do have searchform.php in your theme, it will be used instead. The input text field should be named s and you should always include a label like in the examples below.
[WordPress Search Form Function... |
320,836 | <p>Before I start, I have to say that I have tried to solve my problem in a thousand different ways and I have read several posts without success.</p>
<p>I have a CPT called "grouped", a taxonomy for that CPT called "orders" and within the WordPress panel I have created several "categories" within orders (terms).</p>
... | [
{
"answer_id": 320789,
"author": "Maqk",
"author_id": 86885,
"author_profile": "https://wordpress.stackexchange.com/users/86885",
"pm_score": 3,
"selected": true,
"text": "<p>You can hook into the <code>get_search_form()</code>. Set the priority high enough to override anything created i... | 2018/12/02 | [
"https://wordpress.stackexchange.com/questions/320836",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/155139/"
] | Before I start, I have to say that I have tried to solve my problem in a thousand different ways and I have read several posts without success.
I have a CPT called "grouped", a taxonomy for that CPT called "orders" and within the WordPress panel I have created several "categories" within orders (terms).
I have a term... | You can hook into the `get_search_form()`. Set the priority high enough to override anything created in a theme. If you do have searchform.php in your theme, it will be used instead. The input text field should be named s and you should always include a label like in the examples below.
[WordPress Search Form Function... |
320,841 | <p>Say a site has a category structure like:</p>
<ul>
<li>Dogs</li>
<li><ul>
<li>Boxer</li>
</ul></li>
<li><ul>
<li><ul>
<li>Fawn</li>
</ul></li>
</ul></li>
<li><ul>
<li><ul>
<li>Brindle</li>
</ul></li>
</ul></li>
<li><ul>
<li>Rottweiler</li>
</ul></li>
<li>Cats</li>
<li><ul>
<li>Calico </li>
</ul></li>
<li><ul>
<li>S... | [
{
"answer_id": 320789,
"author": "Maqk",
"author_id": 86885,
"author_profile": "https://wordpress.stackexchange.com/users/86885",
"pm_score": 3,
"selected": true,
"text": "<p>You can hook into the <code>get_search_form()</code>. Set the priority high enough to override anything created i... | 2018/12/03 | [
"https://wordpress.stackexchange.com/questions/320841",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/5465/"
] | Say a site has a category structure like:
* Dogs
* + Boxer
* + - Fawn
* + - Brindle
* + Rottweiler
* Cats
* + Calico
* + Siamese
Using it shows that and adds classes so that you can style it accordingly such as making sure sub levels are indented.
If you want to show just one hierarchy such as Dogs where the catego... | You can hook into the `get_search_form()`. Set the priority high enough to override anything created in a theme. If you do have searchform.php in your theme, it will be used instead. The input text field should be named s and you should always include a label like in the examples below.
[WordPress Search Form Function... |
320,845 | <p>I am creating a Wordpress site, but I have a problem with desktop version of Chrome and Opera - my header displays differently here (in all other browsers everything works just fine). </p>
<p>Here are screenshots showing what I mean:</p>
<p>Firefox: <a href="https://i.imgur.com/4U11dfN.png" rel="nofollow noreferre... | [
{
"answer_id": 320789,
"author": "Maqk",
"author_id": 86885,
"author_profile": "https://wordpress.stackexchange.com/users/86885",
"pm_score": 3,
"selected": true,
"text": "<p>You can hook into the <code>get_search_form()</code>. Set the priority high enough to override anything created i... | 2018/12/03 | [
"https://wordpress.stackexchange.com/questions/320845",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/136124/"
] | I am creating a Wordpress site, but I have a problem with desktop version of Chrome and Opera - my header displays differently here (in all other browsers everything works just fine).
Here are screenshots showing what I mean:
Firefox: <https://i.imgur.com/4U11dfN.png> (everything's fine)
Chrome (in Opera it looks th... | You can hook into the `get_search_form()`. Set the priority high enough to override anything created in a theme. If you do have searchform.php in your theme, it will be used instead. The input text field should be named s and you should always include a label like in the examples below.
[WordPress Search Form Function... |
320,851 | <p>So, I'm using a wordpress theme (unfortunately, I'm not able to get support for the theme any longer), and it has a contact form that makes a direct ajax call to a php file in the theme's "includes" folder. However, all ajax calls to this file result in a 404 error. As a result, the contact form is not able to succe... | [
{
"answer_id": 320789,
"author": "Maqk",
"author_id": 86885,
"author_profile": "https://wordpress.stackexchange.com/users/86885",
"pm_score": 3,
"selected": true,
"text": "<p>You can hook into the <code>get_search_form()</code>. Set the priority high enough to override anything created i... | 2018/12/03 | [
"https://wordpress.stackexchange.com/questions/320851",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/155150/"
] | So, I'm using a wordpress theme (unfortunately, I'm not able to get support for the theme any longer), and it has a contact form that makes a direct ajax call to a php file in the theme's "includes" folder. However, all ajax calls to this file result in a 404 error. As a result, the contact form is not able to successf... | You can hook into the `get_search_form()`. Set the priority high enough to override anything created in a theme. If you do have searchform.php in your theme, it will be used instead. The input text field should be named s and you should always include a label like in the examples below.
[WordPress Search Form Function... |
320,884 | <p>I'm trying to change the text in the 'Place order' button on my multilingual site in WooCommerce. My default lang is English US, other is Polish. I can easily modify the secondary language text via my WPML plugin, but I cannot change the default language.
I tried modifying the button text via a JS code which worked ... | [
{
"answer_id": 320898,
"author": "dado",
"author_id": 109316,
"author_profile": "https://wordpress.stackexchange.com/users/109316",
"pm_score": 0,
"selected": false,
"text": "<p>If you have static texts, which are hard-coded in the PHP, you can just use GetText calls, like:</p>\n\n<pre><... | 2018/12/03 | [
"https://wordpress.stackexchange.com/questions/320884",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/142331/"
] | I'm trying to change the text in the 'Place order' button on my multilingual site in WooCommerce. My default lang is English US, other is Polish. I can easily modify the secondary language text via my WPML plugin, but I cannot change the default language.
I tried modifying the button text via a JS code which worked in ... | You could use their filter to do this:
```
/* Add to the functions.php file of your theme */
add_filter( 'woocommerce_order_button_text', 'woo_custom_order_button_text' );
function woo_custom_order_button_text() {
return __( 'Your new button text here', 'woocommerce' );
}
``` |
320,964 | <p>I have a class "rty-downloads" I want this class to displayed only for WordPress login users, is that possible?</p>
<p>Thanks in advance</p>
| [
{
"answer_id": 320966,
"author": "dado",
"author_id": 109316,
"author_profile": "https://wordpress.stackexchange.com/users/109316",
"pm_score": 0,
"selected": false,
"text": "<p>Try this</p>\n\n<pre><code> add_action( 'loop_start', 'your_function' );\n function your_function() {\n\n... | 2018/12/04 | [
"https://wordpress.stackexchange.com/questions/320964",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/102195/"
] | I have a class "rty-downloads" I want this class to displayed only for WordPress login users, is that possible?
Thanks in advance | You can use this on any WordPress page / template.
```
<?php if ( is_user_logged_in() ) : ?>
//Code for only logged in users
<?php endif; ?>
```
Checkout the docs for more info: <https://developer.wordpress.org/reference/functions/is_user_logged_in/> |
320,979 | <p>I am building a plugin and I want to add some settings which rely on checkboxes.
I know how to get data from the checkbox in PHP but got stuck in WordPress. Because we have no option to add the name attribute to the checkbox. for example, I am adding a checkbox in the customizer.</p>
<pre><code>$wp_customize->... | [
{
"answer_id": 320980,
"author": "dado",
"author_id": 109316,
"author_profile": "https://wordpress.stackexchange.com/users/109316",
"pm_score": 0,
"selected": false,
"text": "<p>Sanitizing a checkbox is quite easy. Since the checkbox value is either true or false (1 or 0), you simply nee... | 2018/12/04 | [
"https://wordpress.stackexchange.com/questions/320979",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/149333/"
] | I am building a plugin and I want to add some settings which rely on checkboxes.
I know how to get data from the checkbox in PHP but got stuck in WordPress. Because we have no option to add the name attribute to the checkbox. for example, I am adding a checkbox in the customizer.
```
$wp_customize->add_setting('ion'... | It has been quite some time, but you can simply check if the mod value is `true` or `false`.
```
<?php
if( get_theme_mod('ion') == true ){
//your html
}
?>
``` |
321,018 | <p>I'm currently trying to unset a session variable in WordPress if the page get's reloaded. I've tried a lot but it's not working like I want it. This is my function:</p>
<pre><code>/**
* Unset filter session if page get's reloaded
*/
add_action( 'wp', 'unset_filter_session' );
function unset_filter_session() {
... | [
{
"answer_id": 321019,
"author": "Sally CJ",
"author_id": 137402,
"author_profile": "https://wordpress.stackexchange.com/users/137402",
"pm_score": 3,
"selected": true,
"text": "<p>Try using <a href=\"https://developer.wordpress.org/reference/functions/wp_doing_ajax/\" rel=\"nofollow nor... | 2018/12/05 | [
"https://wordpress.stackexchange.com/questions/321018",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/151233/"
] | I'm currently trying to unset a session variable in WordPress if the page get's reloaded. I've tried a lot but it's not working like I want it. This is my function:
```
/**
* Unset filter session if page get's reloaded
*/
add_action( 'wp', 'unset_filter_session' );
function unset_filter_session() {
//Reset sessi... | Try using [`wp_doing_ajax()`](https://developer.wordpress.org/reference/functions/wp_doing_ajax/) like so:
```
function unset_filter_session() {
if ( ! wp_doing_ajax() ) {
//Reset sessions on refresh page
unset( $_SESSION['expenditure_filter'] );
}
}
```
UPDATE
------
*You can check the answ... |
321,078 | <p>As the 5.0 is getting real, and so is Gutenberg...</p>
<p>Is it possible to disable Gutenberg and use previous TinyMCE editor?</p>
<p>How to do this?</p>
| [
{
"answer_id": 321079,
"author": "Krzysiek Dróżdż",
"author_id": 34172,
"author_profile": "https://wordpress.stackexchange.com/users/34172",
"pm_score": 4,
"selected": true,
"text": "<p>Yes, you can disable it.</p>\n\n<h2>You can do this with code</h2>\n\n<p>If you want to disable it glo... | 2018/12/05 | [
"https://wordpress.stackexchange.com/questions/321078",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/34172/"
] | As the 5.0 is getting real, and so is Gutenberg...
Is it possible to disable Gutenberg and use previous TinyMCE editor?
How to do this? | Yes, you can disable it.
You can do this with code
-------------------------
If you want to disable it globally, you can use this code:
```
if ( version_compare($GLOBALS['wp_version'], '5.0-beta', '>') ) {
// WP > 5 beta
add_filter( 'use_block_editor_for_post_type', '__return_false', 100 );
} else {
// W... |
321,084 | <p>I need to update date and time when I save posts.
I see the code on the following thread, but I need to have this trick only for posts contained in my custom post 'new_cpt'</p>
<p>Is it possible?</p>
<p>ref: <a href="https://wordpress.stackexchange.com/questions/121565/update-post-date-to-modified-date-automatical... | [
{
"answer_id": 321085,
"author": "Krzysiek Dróżdż",
"author_id": 34172,
"author_profile": "https://wordpress.stackexchange.com/users/34172",
"pm_score": 0,
"selected": false,
"text": "<p>Yes, it is possible. All you have to do is to check the post type before you update dates:</p>\n\n<pr... | 2018/12/05 | [
"https://wordpress.stackexchange.com/questions/321084",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/134550/"
] | I need to update date and time when I save posts.
I see the code on the following thread, but I need to have this trick only for posts contained in my custom post 'new\_cpt'
Is it possible?
ref: [Update post date to modified date automatically](https://wordpress.stackexchange.com/questions/121565/update-post-date-to-... | Using your example link, I just added an IF to check for post\_type.
```
function reset_post_date_wpse_121565($data,$postarr) {
// var_dump($data,$postarr); die;// debug
if($data['post_type'] == 'new_cpt'){
$data['post_date'] = $data['post_modified'];
$data['post_date_gmt'] = $data['post_modif... |
321,095 | <p>I would appreciate any help. I have set a contact form up and want to show a button to download a file once the form is submitted. This is showing all the time and should be hidden until the form is filled in.</p>
<pre><code> <div class="visible-only-if-sent">
<a href="demo.ogi.co.uk/downl... | [
{
"answer_id": 321098,
"author": "dado",
"author_id": 109316,
"author_profile": "https://wordpress.stackexchange.com/users/109316",
"pm_score": 1,
"selected": false,
"text": "<p>You can add listener on submit ..something like this:</p>\n\n<pre><code> document.addEventListener( 'wpcf7sub... | 2018/12/05 | [
"https://wordpress.stackexchange.com/questions/321095",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/155342/"
] | I would appreciate any help. I have set a contact form up and want to show a button to download a file once the form is submitted. This is showing all the time and should be hidden until the form is filled in.
```
<div class="visible-only-if-sent">
<a href="demo.ogi.co.uk/download/1323" class="button big_large_ful... | You can add listener on submit ..something like this:
```
document.addEventListener( 'wpcf7submit', function( event )
{ if ( '123' == event.detail.contactFormId )
{ alert( "The contact form ID is 123." ); // do something productive } },
false );
``` |
321,221 | <p>I'd like to be able to edit the description/help text that appears beneath the field in the CMS page editor for a custom post type.</p>
<p>I know I can change the name and button/link text by passing items into the <code>labels</code> array in register post type.</p>
<pre><code>'featured_image' => __('Foo'),
's... | [
{
"answer_id": 321222,
"author": "RiddleMeThis",
"author_id": 86845,
"author_profile": "https://wordpress.stackexchange.com/users/86845",
"pm_score": 1,
"selected": false,
"text": "<h3>The following will add help text to the initial \"Set featured image\" text.</h3>\n\n<p>Add the followi... | 2018/12/06 | [
"https://wordpress.stackexchange.com/questions/321221",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/90000/"
] | I'd like to be able to edit the description/help text that appears beneath the field in the CMS page editor for a custom post type.
I know I can change the name and button/link text by passing items into the `labels` array in register post type.
```
'featured_image' => __('Foo'),
'set_featured_image' => __('Set Foo')... | @RiddleMeThis got me pointed in the right direction, but I needed it to only apply to a single post type so this is my solution:
```
add_filter('admin_post_thumbnail_html', function ($content) {
global $pagenow;
$isNewFoo = 'post-new.php' === $pagenow && isset($_GET['post_type']) && $_GET['post_type'] === 'fo... |
321,225 | <p>I'm trying to make a plugin that merges two carts into one.</p>
<p>I am doing the following: </p>
<pre><code>$old_order = wc_get_order($old_order_id);
duplicate_line_items($new_order, $old_order);
//re-fetch order to make sure changes aren't lost.
$new_order = $wc_get_order($new_order->get_id());
$new_order->... | [
{
"answer_id": 321222,
"author": "RiddleMeThis",
"author_id": 86845,
"author_profile": "https://wordpress.stackexchange.com/users/86845",
"pm_score": 1,
"selected": false,
"text": "<h3>The following will add help text to the initial \"Set featured image\" text.</h3>\n\n<p>Add the followi... | 2018/12/06 | [
"https://wordpress.stackexchange.com/questions/321225",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/155400/"
] | I'm trying to make a plugin that merges two carts into one.
I am doing the following:
```
$old_order = wc_get_order($old_order_id);
duplicate_line_items($new_order, $old_order);
//re-fetch order to make sure changes aren't lost.
$new_order = $wc_get_order($new_order->get_id());
$new_order->calculate_totals();
$new_o... | @RiddleMeThis got me pointed in the right direction, but I needed it to only apply to a single post type so this is my solution:
```
add_filter('admin_post_thumbnail_html', function ($content) {
global $pagenow;
$isNewFoo = 'post-new.php' === $pagenow && isset($_GET['post_type']) && $_GET['post_type'] === 'fo... |
321,250 | <p>I'm trying to find a way how to have a simple conditional whereby I can echo something depending on whether the post date is in the first half or last half of the post date year.</p>
| [
{
"answer_id": 321253,
"author": "windyjonas",
"author_id": 221,
"author_profile": "https://wordpress.stackexchange.com/users/221",
"pm_score": 2,
"selected": false,
"text": "<p>Are you thinking of something like this?</p>\n\n<pre><code>if ( have_posts() ) {\n while ( have_posts() ) {... | 2018/12/07 | [
"https://wordpress.stackexchange.com/questions/321250",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/37346/"
] | I'm trying to find a way how to have a simple conditional whereby I can echo something depending on whether the post date is in the first half or last half of the post date year. | I found this elsewhere and it worked for me...
```
if( (int)get_the_time( 'm' ) <= 6 ) {
echo 'Some time between January and June.';
} else {
echo 'Some time between July and December.';
}
``` |
321,280 | <p>I have a relationship field that outputs posts from a custom post type. However, if I unpublish one of those posts, it still shows in the outputted code. </p>
<p>I'm aware it's possible to set the fields to only allow the user to select from published posts only (in the admin), but I'm not sure how to add a check i... | [
{
"answer_id": 321253,
"author": "windyjonas",
"author_id": 221,
"author_profile": "https://wordpress.stackexchange.com/users/221",
"pm_score": 2,
"selected": false,
"text": "<p>Are you thinking of something like this?</p>\n\n<pre><code>if ( have_posts() ) {\n while ( have_posts() ) {... | 2018/12/07 | [
"https://wordpress.stackexchange.com/questions/321280",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/22448/"
] | I have a relationship field that outputs posts from a custom post type. However, if I unpublish one of those posts, it still shows in the outputted code.
I'm aware it's possible to set the fields to only allow the user to select from published posts only (in the admin), but I'm not sure how to add a check in the ACF ... | I found this elsewhere and it worked for me...
```
if( (int)get_the_time( 'm' ) <= 6 ) {
echo 'Some time between January and June.';
} else {
echo 'Some time between July and December.';
}
``` |
321,293 | <p>currently I am working on some customized blog templating and was wondering if there is any way to find out if the newest post of a category is also the newest post of the whole blog, so I can skip the first post of the category.</p>
<p><a href="https://i.stack.imgur.com/JrDtT.jpg" rel="nofollow noreferrer"><img sr... | [
{
"answer_id": 321295,
"author": "Krzysiek Dróżdż",
"author_id": 34172,
"author_profile": "https://wordpress.stackexchange.com/users/34172",
"pm_score": 1,
"selected": false,
"text": "<p>Just use ‘post__not_in’ param in your second query.</p>\n\n<pre><code>$query1 = new WP_Query...\n$use... | 2018/12/07 | [
"https://wordpress.stackexchange.com/questions/321293",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/94786/"
] | currently I am working on some customized blog templating and was wondering if there is any way to find out if the newest post of a category is also the newest post of the whole blog, so I can skip the first post of the category.
[](https://i.stack.im... | So the easiest way to do this would be to store the ID of the first post `(1)` then in each of your category loops you can use the `post__not_in` property like so:
```
// inside the first loop at the top.
$latest_post_id = get_the_ID();
// WP_Query for fetching each category
$category_query = new WP_Query( [
// oth... |
321,297 | <p>I am using a URL rewrite to put the user's display name in the URL to display a user profile. This part all works fine and the proper value is passed through the query_vars and I can get the correct user.</p>
<p>Since this is for a plugin, some plugin users may want to use the user's first/last name instead of the... | [
{
"answer_id": 321299,
"author": "kero",
"author_id": 108180,
"author_profile": "https://wordpress.stackexchange.com/users/108180",
"pm_score": 1,
"selected": false,
"text": "<pre><code>$user = reset( get_users( array(\n</code></pre>\n\n<p>The function <code>reset()</code> changes the pa... | 2018/12/07 | [
"https://wordpress.stackexchange.com/questions/321297",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/38603/"
] | I am using a URL rewrite to put the user's display name in the URL to display a user profile. This part all works fine and the proper value is passed through the query\_vars and I can get the correct user.
Since this is for a plugin, some plugin users may want to use the user's first/last name instead of the display n... | The value passed to [`reset()`](http://php.net/manual/en/function.reset.php) is [passed by reference](http://php.net/manual/en/language.references.pass.php), which means technically it modifies the original variable that's passed to it. For this to work you need to pass a variable, not a function that returns a value. ... |
321,320 | <p>This is a common query to delete all post revisions:</p>
<pre><code>DELETE a,b,c
FROM wp_posts a
LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id)
LEFT JOIN wp_postmeta c ON (a.ID = c.post_id)
WHERE a.post_type = 'revision'
</code></pre>
<p>Will this work to delete all drafts?</p>
<pre><code>DELETE a,b,c
... | [
{
"answer_id": 321321,
"author": "Jacob Peattie",
"author_id": 39152,
"author_profile": "https://wordpress.stackexchange.com/users/39152",
"pm_score": 3,
"selected": true,
"text": "<p><code>draft</code> is not a <code>post_type</code>, it's a <code>post_status</code>. So you should use y... | 2018/12/07 | [
"https://wordpress.stackexchange.com/questions/321320",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/101490/"
] | This is a common query to delete all post revisions:
```
DELETE a,b,c
FROM wp_posts a
LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id)
LEFT JOIN wp_postmeta c ON (a.ID = c.post_id)
WHERE a.post_type = 'revision'
```
Will this work to delete all drafts?
```
DELETE a,b,c
FROM wp_posts a
LEFT JOIN wp_term_rel... | `draft` is not a `post_type`, it's a `post_status`. So you should use your second block of code with that substitution:
```
DELETE a,b,c
FROM wp_posts a
LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id)
LEFT JOIN wp_postmeta c ON (a.ID = c.post_id)
WHERE a.post_status = 'draft'
``` |
321,328 | <p>Today I tried to change the webserver to php fpm and it is really very fast
<br>
But there is a very serious problem I found when I installed Wordpress, when I changed the premalink to anything but the normal, it not working and gives me "404 error"
<br>
I don't know what is the problem, Is it a server problem or w... | [
{
"answer_id": 321962,
"author": "Arvind Singh",
"author_id": 113501,
"author_profile": "https://wordpress.stackexchange.com/users/113501",
"pm_score": 0,
"selected": false,
"text": "<p>Check your </p>\n\n<blockquote>\n <p>.htaccess file for apache server </p>\n</blockquote>\n\n<pre><co... | 2018/12/07 | [
"https://wordpress.stackexchange.com/questions/321328",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/154315/"
] | Today I tried to change the webserver to php fpm and it is really very fast
But there is a very serious problem I found when I installed Wordpress, when I changed the premalink to anything but the normal, it not working and gives me "404 error"
I don't know what is the problem, Is it a server problem or worpdress ?
... | It was a nginx config problem
Solved it by adding this line to .conf file
```
try_files $uri $uri/ /index.php?q=$uri&$args;
``` |
321,340 | <p>Right beneath the testimonial is the text <code><p>Tony (Property Manager)</p></code>, but it's overlapped by the WordPress 5.0 gallery that follows it. I don't think it's a float problem.</p>
<p>Here: <a href="http://www.sunnyexteriors.ca/tony-property-manager-soffits/" rel="nofollow noreferrer">http:/... | [
{
"answer_id": 321962,
"author": "Arvind Singh",
"author_id": 113501,
"author_profile": "https://wordpress.stackexchange.com/users/113501",
"pm_score": 0,
"selected": false,
"text": "<p>Check your </p>\n\n<blockquote>\n <p>.htaccess file for apache server </p>\n</blockquote>\n\n<pre><co... | 2018/12/07 | [
"https://wordpress.stackexchange.com/questions/321340",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/155098/"
] | Right beneath the testimonial is the text `<p>Tony (Property Manager)</p>`, but it's overlapped by the WordPress 5.0 gallery that follows it. I don't think it's a float problem.
Here: <http://www.sunnyexteriors.ca/tony-property-manager-soffits/> | It was a nginx config problem
Solved it by adding this line to .conf file
```
try_files $uri $uri/ /index.php?q=$uri&$args;
``` |
321,370 | <p>Is there a setting in WordPress Gutenberg editor to change the font size of the text we type while writing posts? I mean the text size inside the editor itself, not the published text that blog visitors view.</p>
| [
{
"answer_id": 321373,
"author": "Glenn Greening",
"author_id": 154275,
"author_profile": "https://wordpress.stackexchange.com/users/154275",
"pm_score": 2,
"selected": false,
"text": "<p>Just click on the settings/cog icon on the right hand side when you are editing paragraph. Then choo... | 2018/12/08 | [
"https://wordpress.stackexchange.com/questions/321370",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/112076/"
] | Is there a setting in WordPress Gutenberg editor to change the font size of the text we type while writing posts? I mean the text size inside the editor itself, not the published text that blog visitors view. | If you came here, like me, looking for how to adjust the available text size options within Gutenberg, you can add this code to your theme's `functions.php` file (you can add as many options as you like):
```
add_theme_support(
'editor-font-sizes',
array(
array(
'name' => __( 'Normal'... |
321,398 | <p>I have two sites running WordPress 4.9.8</p>
<p>On one site I can see "Store uploads in this folder" option on in Media Settings</p>
<p><a href="https://i.stack.imgur.com/IbMma.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IbMma.png" alt="enter image description here"></a></p>
<p>On another s... | [
{
"answer_id": 321402,
"author": "Mark Kaplun",
"author_id": 23970,
"author_profile": "https://wordpress.stackexchange.com/users/23970",
"pm_score": 1,
"selected": false,
"text": "<p>IIRC the option was softly deprecated sometime in the past, but if you have an old install it will still ... | 2018/12/08 | [
"https://wordpress.stackexchange.com/questions/321398",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/130520/"
] | I have two sites running WordPress 4.9.8
On one site I can see "Store uploads in this folder" option on in Media Settings
[](https://i.stack.imgur.com/IbMma.png)
On another site I cannot see "Store uploads in this folder" option in Media Settings
[... | While the other answers cover part of the answer (old WP install), it is important to note: The options appear, **if one of the options is set**. They are stored via the keys `upload_path` and `upload_url_path`.
Before:
[](https://i.stack.imgur.com/a... |
321,422 | <p>very new here to php and wordpress coding (1 day lol). This is my code so far, the problem is that when there is no value assigned to this attribute I receive and error message. I know I need something that says if the value exists then display the rest of the code but not sure how to go about adding that. This is f... | [
{
"answer_id": 321402,
"author": "Mark Kaplun",
"author_id": 23970,
"author_profile": "https://wordpress.stackexchange.com/users/23970",
"pm_score": 1,
"selected": false,
"text": "<p>IIRC the option was softly deprecated sometime in the past, but if you have an old install it will still ... | 2018/12/08 | [
"https://wordpress.stackexchange.com/questions/321422",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/155554/"
] | very new here to php and wordpress coding (1 day lol). This is my code so far, the problem is that when there is no value assigned to this attribute I receive and error message. I know I need something that says if the value exists then display the rest of the code but not sure how to go about adding that. This is for ... | While the other answers cover part of the answer (old WP install), it is important to note: The options appear, **if one of the options is set**. They are stored via the keys `upload_path` and `upload_url_path`.
Before:
[](https://i.stack.imgur.com/a... |
321,450 | <p>I have some post in my autoblog that by cronjob mistake the feautured image being deleted.
how to find all of that post (<strong>post with broken image link</strong>) and delete all of it or set the default image if the featured image is missing without searching one by one through thousand of post.</p>
| [
{
"answer_id": 321402,
"author": "Mark Kaplun",
"author_id": 23970,
"author_profile": "https://wordpress.stackexchange.com/users/23970",
"pm_score": 1,
"selected": false,
"text": "<p>IIRC the option was softly deprecated sometime in the past, but if you have an old install it will still ... | 2018/12/09 | [
"https://wordpress.stackexchange.com/questions/321450",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/155571/"
] | I have some post in my autoblog that by cronjob mistake the feautured image being deleted.
how to find all of that post (**post with broken image link**) and delete all of it or set the default image if the featured image is missing without searching one by one through thousand of post. | While the other answers cover part of the answer (old WP install), it is important to note: The options appear, **if one of the options is set**. They are stored via the keys `upload_path` and `upload_url_path`.
Before:
[](https://i.stack.imgur.com/a... |
321,474 | <p>I a problem with getting the query for custom taxonomy to work in this function. The $filter is filled with data but the get_posts() does not use it? The query works without the tax_query and there are: custom posts with the correct taxonomy(list)... want am I missing?</p>
<pre><code>add_action( 'restrict_manage_po... | [
{
"answer_id": 321402,
"author": "Mark Kaplun",
"author_id": 23970,
"author_profile": "https://wordpress.stackexchange.com/users/23970",
"pm_score": 1,
"selected": false,
"text": "<p>IIRC the option was softly deprecated sometime in the past, but if you have an old install it will still ... | 2018/12/09 | [
"https://wordpress.stackexchange.com/questions/321474",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/155586/"
] | I a problem with getting the query for custom taxonomy to work in this function. The $filter is filled with data but the get\_posts() does not use it? The query works without the tax\_query and there are: custom posts with the correct taxonomy(list)... want am I missing?
```
add_action( 'restrict_manage_posts', 'add_e... | While the other answers cover part of the answer (old WP install), it is important to note: The options appear, **if one of the options is set**. They are stored via the keys `upload_path` and `upload_url_path`.
Before:
[](https://i.stack.imgur.com/a... |
321,525 | <p>I want to get the data from advanced custom field using wp_query from another custom post type:</p>
<pre><code> $title = get_the_title();
$the_query = new WP_Query( array(
'posts_per_page'=>9,
'post_type'=>'product_name',
'order' => 'ASC',
'brand_name' => $title, /*brand_name is my cu... | [
{
"answer_id": 321526,
"author": "Greg Winiarski",
"author_id": 154460,
"author_profile": "https://wordpress.stackexchange.com/users/154460",
"pm_score": 1,
"selected": false,
"text": "<p>ACF plugin stores data in the wp_postmeta like the default WordPress custom fields.</p>\n\n<p>To get... | 2018/12/10 | [
"https://wordpress.stackexchange.com/questions/321525",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | I want to get the data from advanced custom field using wp\_query from another custom post type:
```
$title = get_the_title();
$the_query = new WP_Query( array(
'posts_per_page'=>9,
'post_type'=>'product_name',
'order' => 'ASC',
'brand_name' => $title, /*brand_name is my custom field name*/
'pa... | ACF plugin stores data in the wp\_postmeta like the default WordPress custom fields.
To get data from a custom field your code should look like this (assuming the custom field name is "brand\_name").
```
$title = get_the_title();
$the_query = new WP_Query( array(
'posts_per_page'=>9,
'post_type'=>'product_name',
... |
321,538 | <p>And where do I (reliably) look for this kind of information? I find myself googling for 'wordpress changelog' on every other update...</p>
<p>Background: usually I use a "skeletal" WP installation (seperate <code>wp</code>/<code>app</code> and <code>wp-content</code> folders), so I could try out the new major versi... | [
{
"answer_id": 321540,
"author": "Jose Guerra",
"author_id": 153734,
"author_profile": "https://wordpress.stackexchange.com/users/153734",
"pm_score": 0,
"selected": false,
"text": "<p>I upgraded 2 of my sites from version 4.9.8 to 5.0 and it did not require any database update. Also I h... | 2018/12/10 | [
"https://wordpress.stackexchange.com/questions/321538",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/152837/"
] | And where do I (reliably) look for this kind of information? I find myself googling for 'wordpress changelog' on every other update...
Background: usually I use a "skeletal" WP installation (seperate `wp`/`app` and `wp-content` folders), so I could try out the new major version and check for theme incompatibilites by ... | So after some thinking I came up with this:
[Codex / Wordpress Versions](https://codex.wordpress.org/Current_events) has Changelogs, but these seem to mention (recent) database upgrades implicitly, starting at 5.0. (Compare how [Matomo explicitly states DB upgrades](https://matomo.org/changelog/piwik-3-0-0/)). Maybe t... |
321,542 | <p>What I'm trying to do is to take the categories for products which are in the cart. Then check via some conditions what category id is and show different notice. </p>
<p>So far I have this</p>
<pre><code>/**
* Cart collaterals hook.
*
* @hooked woocommerce_cross_sell_display
* @hooked woocommerce_cart_totals - 10
... | [
{
"answer_id": 321555,
"author": "Sally CJ",
"author_id": 137402,
"author_profile": "https://wordpress.stackexchange.com/users/137402",
"pm_score": 3,
"selected": true,
"text": "<p>Use <code>$cart_item['data']->get_category_ids()</code> to retrieve the category IDs:</p>\n\n<pre><code>... | 2018/12/10 | [
"https://wordpress.stackexchange.com/questions/321542",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/100661/"
] | What I'm trying to do is to take the categories for products which are in the cart. Then check via some conditions what category id is and show different notice.
So far I have this
```
/**
* Cart collaterals hook.
*
* @hooked woocommerce_cross_sell_display
* @hooked woocommerce_cart_totals - 10
*/
$categories = arra... | Use `$cart_item['data']->get_category_ids()` to retrieve the category IDs:
```
$category_ids = $cart_item['data']->get_category_ids(); // array
```
The `category_ids` you see is not a direct item in the `$cart_item` array:
```
var_dump( $cart_item['category_ids'] ); // null and PHP throws a notice
```
It's an ite... |
321,606 | <pre><code>remove_action('woocommerce_shop_loop_item_title','woocommerce_template_loop_product_title',10);
add_action('woocommerce_shop_loop_item_title','fun',10);
function fun()
{
echo 'custom_field_value';
}
</code></pre>
<p>Note: I want to replace the title on shop page with custom field value. The code is correc... | [
{
"answer_id": 321580,
"author": "lotto_guy",
"author_id": 124674,
"author_profile": "https://wordpress.stackexchange.com/users/124674",
"pm_score": 0,
"selected": false,
"text": "<p>You can use the Theme My Login plugin where there is an option to have a custom registration page on the... | 2018/12/11 | [
"https://wordpress.stackexchange.com/questions/321606",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/155687/"
] | ```
remove_action('woocommerce_shop_loop_item_title','woocommerce_template_loop_product_title',10);
add_action('woocommerce_shop_loop_item_title','fun',10);
function fun()
{
echo 'custom_field_value';
}
```
Note: I want to replace the title on shop page with custom field value. The code is correct but the echo part... | The registration form is generated by code directly in `wp-login.php` (<https://core.trac.wordpress.org/browser/branches/5.0/src/wp-login.php#L786>) and this code is not wrapped with any function, so... I'm afraid there is no such function ready to use.
Of course you can mimic the code from the file above and wrap it ... |
321,657 | <p>I made a plugin that basically reads a CSV file and imports data to relevant tables.</p>
<p>However, the action seems to create an error:</p>
<blockquote>
<p>Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 65015808 bytes) in <b>/var/www/proj/wp-includes/functions.php</b> on line... | [
{
"answer_id": 321660,
"author": "Tim Hallman",
"author_id": 38375,
"author_profile": "https://wordpress.stackexchange.com/users/38375",
"pm_score": 0,
"selected": false,
"text": "<p>In your functions file do something like this:</p>\n\n<pre><code>add_action('wp_ajax_import_parts_abc', '... | 2018/12/11 | [
"https://wordpress.stackexchange.com/questions/321657",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/155748/"
] | I made a plugin that basically reads a CSV file and imports data to relevant tables.
However, the action seems to create an error:
>
> Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 65015808 bytes) in **/var/www/proj/wp-includes/functions.php** on line
>
>
>
which led me to thi... | Depending on what exactly you're trying to achieve, I agree with [Tom's comment](https://wordpress.stackexchange.com/questions/321657/memory-leak-in-plugin-action?noredirect=1#comment475327_321657), that a WP-CLI command might be better. The advantage is that the command runs from php directly on the server (usually ha... |
321,662 | <p>I've registered a custom editor block with Advanced Custom Fields (ACF), and am using <code>render_template</code> with a PHP template partial to display the block contents.</p>
<p>Inside the template is some HTML (<code>section</code> with a <code>figure</code> and an <code>a</code> inside it). When the block is c... | [
{
"answer_id": 321667,
"author": "Morgan Estes",
"author_id": 26317,
"author_profile": "https://wordpress.stackexchange.com/users/26317",
"pm_score": 2,
"selected": false,
"text": "<p>I've found that I can use the <code>render_block</code> filter to disable <code>wpautop()</code> when a ... | 2018/12/11 | [
"https://wordpress.stackexchange.com/questions/321662",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/26317/"
] | I've registered a custom editor block with Advanced Custom Fields (ACF), and am using `render_template` with a PHP template partial to display the block contents.
Inside the template is some HTML (`section` with a `figure` and an `a` inside it). When the block is called and the template generates the HTML, it's exactl... | I've found that I can use the `render_block` filter to disable `wpautop()` when a block gets rendered. It looks to me that this only affects the immediate block, as the filter gets re-enabled from `do_blocks()` calling `_restore_wpautop_hook()`. This lets me avoid using output buffering inside the block template, and m... |
321,674 | <p>I don't understand why my request to WooCommerce API doesn't work.
My usage on react App via axios:</p>
<p>First try:</p>
<pre><code>return axios.get( 'http://domain/wp-json/wc/v3/products?featured=true',
{
headers: {
'consumer_key': 'ck_xxx',
'consumer_secret': 'cs_xxx',
'key_id': ... | [
{
"answer_id": 339181,
"author": "Caio Mar",
"author_id": 54189,
"author_profile": "https://wordpress.stackexchange.com/users/54189",
"pm_score": 3,
"selected": true,
"text": "<p>I was having the same issue with Woocommerce Oauth 1.0 authentication and <a href=\"https://stackoverflow.com... | 2018/12/11 | [
"https://wordpress.stackexchange.com/questions/321674",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/89766/"
] | I don't understand why my request to WooCommerce API doesn't work.
My usage on react App via axios:
First try:
```
return axios.get( 'http://domain/wp-json/wc/v3/products?featured=true',
{
headers: {
'consumer_key': 'ck_xxx',
'consumer_secret': 'cs_xxx',
'key_id': 111,
'key_per... | I was having the same issue with Woocommerce Oauth 1.0 authentication and [this solution](https://stackoverflow.com/a/45465247/2550766) worked for me. I'm running it on localhost, so far so good.
**Edit:**
Let me elaborate this answer a bit more. I just started learning React last night and the best way to learn is b... |
321,726 | <p>I have a CPT and inside the CPT I have a contact form. The contact form directly sends to WordPress dashboard, Now I'm trying to implement when a user submits the contact form they will receive a "Thanks for contacting US" message in their Email address(User fill email in the form) I'm new in WordPress & PHP. I... | [
{
"answer_id": 321735,
"author": "Greg Winiarski",
"author_id": 154460,
"author_profile": "https://wordpress.stackexchange.com/users/154460",
"pm_score": 0,
"selected": false,
"text": "<p>If the post is saved in the database then your <code>mail()</code> nor <code>wp_mail()</code> functi... | 2018/12/12 | [
"https://wordpress.stackexchange.com/questions/321726",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/149857/"
] | I have a CPT and inside the CPT I have a contact form. The contact form directly sends to WordPress dashboard, Now I'm trying to implement when a user submits the contact form they will receive a "Thanks for contacting US" message in their Email address(User fill email in the form) I'm new in WordPress & PHP. I'm using... | I revised your code to address some issues, but there is the possibility that the issue is not your code.
First, you are returning too early. Your original code returns on success before you send the email. I moved this to the end so that it sets a value (success or error) at the end based on whether you have a post I... |
321,764 | <p>Somehow when I was working with my local dev environment, I have made some mistakes in some php files which I could not figure it out.</p>
<p>So, I have decided to copy the files from the <code>public_html</code> and paste in my local copy of the WordPress..</p>
<p>Now when I open my website in my local machine, i... | [
{
"answer_id": 321802,
"author": "Kevin",
"author_id": 153905,
"author_profile": "https://wordpress.stackexchange.com/users/153905",
"pm_score": -1,
"selected": false,
"text": "<p>One solution is that you might want to include a .htaccess file to your <strong>local</strong> instance.</p>... | 2018/12/12 | [
"https://wordpress.stackexchange.com/questions/321764",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/111408/"
] | Somehow when I was working with my local dev environment, I have made some mistakes in some php files which I could not figure it out.
So, I have decided to copy the files from the `public_html` and paste in my local copy of the WordPress..
Now when I open my website in my local machine, it shows the front page witho... | XAMPP dashboard
===============
XAMP has some default files (example files), you should delete that.
It's just there to show you that everything works as expected.
With also an example .htacess which redirects you to dashboard. Before you copy and paste your files, you should have deleted everything in **C:\xampp\htd... |
321,866 | <p>For my site, I need to have different header colors depending on the page it's on. Here's the code I have for my site that is working:</p>
<pre><code><?php if ( is_single() && is_post_type('product') || is_page(576) || is_single() && is_post_type('post')) : ?>
<div class="header-inner... | [
{
"answer_id": 321869,
"author": "Liam Stewart",
"author_id": 121955,
"author_profile": "https://wordpress.stackexchange.com/users/121955",
"pm_score": 1,
"selected": false,
"text": "<p>You are just passing through multiple values instead of a list. Switch to an array.</p>\n\n<p>Change t... | 2018/12/13 | [
"https://wordpress.stackexchange.com/questions/321866",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/155767/"
] | For my site, I need to have different header colors depending on the page it's on. Here's the code I have for my site that is working:
```
<?php if ( is_single() && is_post_type('product') || is_page(576) || is_single() && is_post_type('post')) : ?>
<div class="header-inner">
<style type="text/css">.header... | Here is an alternative solution. I think it would be cleaner than adding all these if statements and page IDs. You can do this using CSS and the body class WP adds.
For example, go to one of your single pages and look at the class on the body tag. You should see something like page-id-###. Then just simply add a rule ... |
321,868 | <p>I have multiple wp_query's on the same page. Each one of those queries has an AJAX "read more" button at the bottom. The problem I'm finding is that I can only get one to work at a time. Whichever function is added first in the functions.php, that one works - the other one gets a 403 error for admin-ajax.php. <... | [
{
"answer_id": 321883,
"author": "Elkrat",
"author_id": 122051,
"author_profile": "https://wordpress.stackexchange.com/users/122051",
"pm_score": 2,
"selected": false,
"text": "<p>WP ajax is a bit strange. You enqueue the script to get it to show up on the page. You also LOCALIZE your ... | 2018/12/13 | [
"https://wordpress.stackexchange.com/questions/321868",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/111198/"
] | I have multiple wp\_query's on the same page. Each one of those queries has an AJAX "read more" button at the bottom. The problem I'm finding is that I can only get one to work at a time. Whichever function is added first in the functions.php, that one works - the other one gets a 403 error for admin-ajax.php.
I'm pr... | >
> The problem I'm finding is that I can only get one to work at a time.
> Whichever function is added first in the functions.php, that one works
> - the other one gets a 403 error for admin-ajax.php.
>
>
>
Yes, because both your PHP functions (or AJAX callbacks) there are hooked to the *same* AJAX action, whic... |
321,903 | <p>I'm new to building plugins and just for testing purposes I would like to build a simple plugin that changes the title of website. What hooks or filter would I need? </p>
| [
{
"answer_id": 321883,
"author": "Elkrat",
"author_id": 122051,
"author_profile": "https://wordpress.stackexchange.com/users/122051",
"pm_score": 2,
"selected": false,
"text": "<p>WP ajax is a bit strange. You enqueue the script to get it to show up on the page. You also LOCALIZE your ... | 2018/12/14 | [
"https://wordpress.stackexchange.com/questions/321903",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/155932/"
] | I'm new to building plugins and just for testing purposes I would like to build a simple plugin that changes the title of website. What hooks or filter would I need? | >
> The problem I'm finding is that I can only get one to work at a time.
> Whichever function is added first in the functions.php, that one works
> - the other one gets a 403 error for admin-ajax.php.
>
>
>
Yes, because both your PHP functions (or AJAX callbacks) there are hooked to the *same* AJAX action, whic... |
321,951 | <p>I recently changed the permalink structure on my 2-month-old blog to a user friendly one which means a whole bunch of 404s. I wish to redirect the following:</p>
<pre><code>https://example.com/poastname.html
</code></pre>
<p>to</p>
<pre><code>https://example.com/postname/
</code></pre>
<p>Before coming here, I s... | [
{
"answer_id": 321883,
"author": "Elkrat",
"author_id": 122051,
"author_profile": "https://wordpress.stackexchange.com/users/122051",
"pm_score": 2,
"selected": false,
"text": "<p>WP ajax is a bit strange. You enqueue the script to get it to show up on the page. You also LOCALIZE your ... | 2018/12/14 | [
"https://wordpress.stackexchange.com/questions/321951",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/155978/"
] | I recently changed the permalink structure on my 2-month-old blog to a user friendly one which means a whole bunch of 404s. I wish to redirect the following:
```
https://example.com/poastname.html
```
to
```
https://example.com/postname/
```
Before coming here, I spent days looking for this redirect online but ne... | >
> The problem I'm finding is that I can only get one to work at a time.
> Whichever function is added first in the functions.php, that one works
> - the other one gets a 403 error for admin-ajax.php.
>
>
>
Yes, because both your PHP functions (or AJAX callbacks) there are hooked to the *same* AJAX action, whic... |
321,974 | <p>I'm developing some custom blocks in the new Gutenberg editor experience, and I'm struggle to understand how to use some build-in components, mostly the Draggable components.</p>
<p>What I would like to achieve is a list of items (let's say many <code>li</code> in a <code>ul</code>) and I want them to be orderable ... | [
{
"answer_id": 321883,
"author": "Elkrat",
"author_id": 122051,
"author_profile": "https://wordpress.stackexchange.com/users/122051",
"pm_score": 2,
"selected": false,
"text": "<p>WP ajax is a bit strange. You enqueue the script to get it to show up on the page. You also LOCALIZE your ... | 2018/12/14 | [
"https://wordpress.stackexchange.com/questions/321974",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/86838/"
] | I'm developing some custom blocks in the new Gutenberg editor experience, and I'm struggle to understand how to use some build-in components, mostly the Draggable components.
What I would like to achieve is a list of items (let's say many `li` in a `ul`) and I want them to be orderable with a drag & drop feature.
Her... | >
> The problem I'm finding is that I can only get one to work at a time.
> Whichever function is added first in the functions.php, that one works
> - the other one gets a 403 error for admin-ajax.php.
>
>
>
Yes, because both your PHP functions (or AJAX callbacks) there are hooked to the *same* AJAX action, whic... |
322,005 | <p>i.e. when post is registered, like this:</p>
<pre><code>$args= [
'supports' => ['thumbnail', 'title', 'post-formats' ...]
]
</code></pre>
<p>If later, I want to get all <code>supports</code> attribute for specific post type, which function should I use? i.e. something like <code>get_supports('post');</code>... | [
{
"answer_id": 322006,
"author": "T.Todua",
"author_id": 33667,
"author_profile": "https://wordpress.stackexchange.com/users/33667",
"pm_score": 0,
"selected": false,
"text": "<p>I've chosen to use <code>$GLOBALS['_wp_post_type_features']</code>, that returns like this:</p>\n\n<pre><code... | 2018/12/15 | [
"https://wordpress.stackexchange.com/questions/322005",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/33667/"
] | i.e. when post is registered, like this:
```
$args= [
'supports' => ['thumbnail', 'title', 'post-formats' ...]
]
```
If later, I want to get all `supports` attribute for specific post type, which function should I use? i.e. something like `get_supports('post');` | There exists the [`get_all_post_type_supports()`](https://developer.wordpress.org/reference/functions/get_all_post_type_supports/) to get the supported features for a given post type. It's a wrapper for the `_wp_post_type_features` global variable:
```
/**
* Get all the post type features
*
* @since 3.4.0
*
* @gl... |
323,051 | <p>Hello i wonder if you can help me. How do you make to post titles capitalize the first letter of every word?</p>
<p>Is there a way to do it in wordpress?</p>
| [
{
"answer_id": 323052,
"author": "WPZA",
"author_id": 146181,
"author_profile": "https://wordpress.stackexchange.com/users/146181",
"pm_score": 0,
"selected": false,
"text": "<p>Is this for <code><title></title></code> or output title?</p>\n\n<p>If <strong>output title</stron... | 2018/12/16 | [
"https://wordpress.stackexchange.com/questions/323051",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/157056/"
] | Hello i wonder if you can help me. How do you make to post titles capitalize the first letter of every word?
Is there a way to do it in wordpress? | The code below was assembled of different pieces I've found around and it was not tested. Consider it as an idea only.
```
<?php
add_filter( 'the_title', 'my_capitalize_title', 10, 2 );
function my_capitalize_title( $title, $id ) {
// get separate words
$words = preg_split( '/[^\w]*([\s]+[^\w]*|$)/', $title,... |
323,080 | <p>I'm trying to create a new development workflow and for that I need to enqueue some scripts to be available only when I'm developing. What is the correct way to do this? Should I use <code>WP_DEBUG</code> as a condition or is there a better way? </p>
<pre><code>if (WP_DEBUG === true) {
wp_enqueue_script('script_... | [
{
"answer_id": 323052,
"author": "WPZA",
"author_id": 146181,
"author_profile": "https://wordpress.stackexchange.com/users/146181",
"pm_score": 0,
"selected": false,
"text": "<p>Is this for <code><title></title></code> or output title?</p>\n\n<p>If <strong>output title</stron... | 2018/12/16 | [
"https://wordpress.stackexchange.com/questions/323080",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/121208/"
] | I'm trying to create a new development workflow and for that I need to enqueue some scripts to be available only when I'm developing. What is the correct way to do this? Should I use `WP_DEBUG` as a condition or is there a better way?
```
if (WP_DEBUG === true) {
wp_enqueue_script('script_for_development', 'script... | The code below was assembled of different pieces I've found around and it was not tested. Consider it as an idea only.
```
<?php
add_filter( 'the_title', 'my_capitalize_title', 10, 2 );
function my_capitalize_title( $title, $id ) {
// get separate words
$words = preg_split( '/[^\w]*([\s]+[^\w]*|$)/', $title,... |
323,117 | <p>I am trying to invert the order of <code><li></code> and <code><a></code> in a <code>wp_nav_menu</code>, since for a responsive mobile design I like more when the click is done in all the <code><li></code> and not only in the word / s of the link <code><a></code> because is easier for the fin... | [
{
"answer_id": 323124,
"author": "Jacob Peattie",
"author_id": 39152,
"author_profile": "https://wordpress.stackexchange.com/users/39152",
"pm_score": 2,
"selected": false,
"text": "<pre><code><ul>\n <a>\n <li></li>\n </a>\n</ul>\n</code><... | 2018/12/16 | [
"https://wordpress.stackexchange.com/questions/323117",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | I am trying to invert the order of `<li>` and `<a>` in a `wp_nav_menu`, since for a responsive mobile design I like more when the click is done in all the `<li>` and not only in the word / s of the link `<a>` because is easier for the finger.
Thank you.
PS: I must say that I am a newbie in Wordpress development.
This ... | ```
<ul>
<a>
<li></li>
</a>
</ul>
```
Is not valid HTML. An `<a>` tag cannot be a child of a `<ul>` tag. So what you're asking for isn't possible. It's not your actual problem either.
Your problem is a styling problem. If you want a larger touch target on the link, you need to add padding around the ... |
323,153 | <p>I want to hide the add new page button from users that are not administrators. I managed to hide the submenu item from the right column like this:</p>
<pre><code>$page = remove_submenu_page( 'edit.php?post_type=page', 'post-new.php?post_type=page' );
</code></pre>
<p>I tried to hide the button in the page with css... | [
{
"answer_id": 323124,
"author": "Jacob Peattie",
"author_id": 39152,
"author_profile": "https://wordpress.stackexchange.com/users/39152",
"pm_score": 2,
"selected": false,
"text": "<pre><code><ul>\n <a>\n <li></li>\n </a>\n</ul>\n</code><... | 2018/12/17 | [
"https://wordpress.stackexchange.com/questions/323153",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/157147/"
] | I want to hide the add new page button from users that are not administrators. I managed to hide the submenu item from the right column like this:
```
$page = remove_submenu_page( 'edit.php?post_type=page', 'post-new.php?post_type=page' );
```
I tried to hide the button in the page with css proposed in this [questio... | ```
<ul>
<a>
<li></li>
</a>
</ul>
```
Is not valid HTML. An `<a>` tag cannot be a child of a `<ul>` tag. So what you're asking for isn't possible. It's not your actual problem either.
Your problem is a styling problem. If you want a larger touch target on the link, you need to add padding around the ... |
323,155 | <p>My website - <strong>www.In2BalanceKInesiology.com.au</strong> had an WordPress auto update a few days ago and I have not been able to access it since - it is a white screen of death...</p>
| [
{
"answer_id": 323124,
"author": "Jacob Peattie",
"author_id": 39152,
"author_profile": "https://wordpress.stackexchange.com/users/39152",
"pm_score": 2,
"selected": false,
"text": "<pre><code><ul>\n <a>\n <li></li>\n </a>\n</ul>\n</code><... | 2018/12/17 | [
"https://wordpress.stackexchange.com/questions/323155",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/157150/"
] | My website - **www.In2BalanceKInesiology.com.au** had an WordPress auto update a few days ago and I have not been able to access it since - it is a white screen of death... | ```
<ul>
<a>
<li></li>
</a>
</ul>
```
Is not valid HTML. An `<a>` tag cannot be a child of a `<ul>` tag. So what you're asking for isn't possible. It's not your actual problem either.
Your problem is a styling problem. If you want a larger touch target on the link, you need to add padding around the ... |
323,192 | <p>I have a shortcode that displays a block of content. Is there a way I can display different HTML depending on if the user is logged in or not? Below is what I have so far.</p>
<pre><code>function footer_shortcode(){
$siteURL = site_url();
$logoutURL = wp_logout_url(home_url());
echo '
<div... | [
{
"answer_id": 323124,
"author": "Jacob Peattie",
"author_id": 39152,
"author_profile": "https://wordpress.stackexchange.com/users/39152",
"pm_score": 2,
"selected": false,
"text": "<pre><code><ul>\n <a>\n <li></li>\n </a>\n</ul>\n</code><... | 2018/12/17 | [
"https://wordpress.stackexchange.com/questions/323192",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/157172/"
] | I have a shortcode that displays a block of content. Is there a way I can display different HTML depending on if the user is logged in or not? Below is what I have so far.
```
function footer_shortcode(){
$siteURL = site_url();
$logoutURL = wp_logout_url(home_url());
echo '
<div class="signin_cont... | ```
<ul>
<a>
<li></li>
</a>
</ul>
```
Is not valid HTML. An `<a>` tag cannot be a child of a `<ul>` tag. So what you're asking for isn't possible. It's not your actual problem either.
Your problem is a styling problem. If you want a larger touch target on the link, you need to add padding around the ... |
323,212 | <p>Where and how should I even begin to fix terrible design problems? I can't change the theme, I must learn how to fix it the current one, I guess via CSS? How to align all textboxes properly, how to change box (top is gray) color and button color as well? These are all in simple pages via shortcodes. Thanks.</p>
<p>... | [
{
"answer_id": 323216,
"author": "RiddleMeThis",
"author_id": 86845,
"author_profile": "https://wordpress.stackexchange.com/users/86845",
"pm_score": 1,
"selected": true,
"text": "<p>Yes, this can easily be cleaned up with a little CSS. You can start by using the browser's inspector, hi... | 2018/12/17 | [
"https://wordpress.stackexchange.com/questions/323212",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/157188/"
] | Where and how should I even begin to fix terrible design problems? I can't change the theme, I must learn how to fix it the current one, I guess via CSS? How to align all textboxes properly, how to change box (top is gray) color and button color as well? These are all in simple pages via shortcodes. Thanks.
[![enter i... | Yes, this can easily be cleaned up with a little CSS. You can start by using the browser's inspector, hit F12 to open it, and select the element you want to style.
See if that form or something around has an ID, use that to target each element so you don't effect other pages or unwanted elements.
Here are couple exa... |
323,221 | <p>I've tried both of these, but I'm still getting the error message: "Sorry, this file type is not permitted for security reasons."</p>
<pre><code>// add support for webp mime types
function webp_upload_mimes( $existing_mimes ) {
// add webp to the list of mime types
$existing_mimes['webp'] = 'image/webp';
... | [
{
"answer_id": 323225,
"author": "Johansson",
"author_id": 94498,
"author_profile": "https://wordpress.stackexchange.com/users/94498",
"pm_score": 2,
"selected": false,
"text": "<p>Sometimes the uploads are limited by your host. Try and define the <code>ALLOW_UNFILTERED_UPLOADS</code> co... | 2018/12/17 | [
"https://wordpress.stackexchange.com/questions/323221",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/145165/"
] | I've tried both of these, but I'm still getting the error message: "Sorry, this file type is not permitted for security reasons."
```
// add support for webp mime types
function webp_upload_mimes( $existing_mimes ) {
// add webp to the list of mime types
$existing_mimes['webp'] = 'image/webp';
// return t... | It's necessary to use the `wp_check_filetype_and_ext` filter to set the mime type and extension for webp files in addition to using the `upload_mimes` filter to add the mime type to the list of uploadable mimes.
```
/**
* Sets the extension and mime type for .webp files.
*
* @param array $wp_check_filetype_and_ext... |
323,256 | <p>I'm writing a standalone script for Wordpress so I can display things like the username on a page outside of Wordpress.</p>
<p>My method so far is to try to include or require wp-load.php in my script directory. I've tried</p>
<pre><code>chdir ( ".." );
include "wp-load.php";
</code></pre>
<p>as well as absolute... | [
{
"answer_id": 323234,
"author": "Keonramses",
"author_id": 157195,
"author_profile": "https://wordpress.stackexchange.com/users/157195",
"pm_score": 2,
"selected": false,
"text": "<p>you can try doing a manual update, so as long as you didn't make any changes to the WordPress core files... | 2018/12/18 | [
"https://wordpress.stackexchange.com/questions/323256",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/157212/"
] | I'm writing a standalone script for Wordpress so I can display things like the username on a page outside of Wordpress.
My method so far is to try to include or require wp-load.php in my script directory. I've tried
```
chdir ( ".." );
include "wp-load.php";
```
as well as absolute paths to the web root where Wordp... | you can try doing a manual update, so as long as you didn't make any changes to the WordPress core files(if you did I suggest you take note of them and reapply after the upgrade), just head over to WordPress.org download the latest WordPress package and copy it over to your root folder on the server make sure you overw... |
323,280 | <p>I want to get all post IDs from the current query. I know how to get all IDs of the current page using the following:</p>
<pre><code>global $wp_query;
$post_ids = wp_list_pluck( $wp_query->posts, "ID" );
</code></pre>
<p>This will give me an array of all post IDs, but limited to the current page.</p>
<p>How c... | [
{
"answer_id": 352791,
"author": "Joe",
"author_id": 40614,
"author_profile": "https://wordpress.stackexchange.com/users/40614",
"pm_score": 2,
"selected": false,
"text": "<p>Slightly old post I know but I just hit this exact issue myself.</p>\n\n<p>Given a main_query find all the post I... | 2018/12/18 | [
"https://wordpress.stackexchange.com/questions/323280",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/81143/"
] | I want to get all post IDs from the current query. I know how to get all IDs of the current page using the following:
```
global $wp_query;
$post_ids = wp_list_pluck( $wp_query->posts, "ID" );
```
This will give me an array of all post IDs, but limited to the current page.
How can I get all IDs but not limited by ... | Slightly old post I know but I just hit this exact issue myself.
Given a main\_query find all the post IDs for it not limited by pagination.
I have made this function to return all terms for the main wp\_query.
```
/*
* Get terms for a given wp_query no paging
* */
function get_terms_for_current_posts($tax='post_... |
323,300 | <p>so, I know this is kind of a basic question, but it somehow oddly doesn't work for me.</p>
<p>What I want:</p>
<ul>
<li><a href="https://example.com/blog/thema/" rel="nofollow noreferrer">https://example.com/blog/thema/</a><em>categoryname</em>/<em>postname</em> (for posts)</li>
<li><a href="https://example.com/bl... | [
{
"answer_id": 323301,
"author": "Jacob Peattie",
"author_id": 39152,
"author_profile": "https://wordpress.stackexchange.com/users/39152",
"pm_score": -1,
"selected": false,
"text": "<p>The problem with what you're trying to do is that with your desired structure it's impossible to tell ... | 2018/12/18 | [
"https://wordpress.stackexchange.com/questions/323300",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/94786/"
] | so, I know this is kind of a basic question, but it somehow oddly doesn't work for me.
What I want:
* <https://example.com/blog/thema/>*categoryname*/*postname* (for posts)
* <https://example.com/blog/thema/>*categoryname* (for categories)
Here are my settings:
[{
if( array_key_exists( 'category_name'... |
323,329 | <p>I'm trying to change the logo url for some categories and pages. In the Theme options there is the possibility to change the logo img for categories and pages, but can't change the logo url. I have tried this code in my child theme function.php file but it is not working:</p>
<pre><code>function change_logo_url_ani... | [
{
"answer_id": 323301,
"author": "Jacob Peattie",
"author_id": 39152,
"author_profile": "https://wordpress.stackexchange.com/users/39152",
"pm_score": -1,
"selected": false,
"text": "<p>The problem with what you're trying to do is that with your desired structure it's impossible to tell ... | 2018/12/18 | [
"https://wordpress.stackexchange.com/questions/323329",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/154563/"
] | I'm trying to change the logo url for some categories and pages. In the Theme options there is the possibility to change the logo img for categories and pages, but can't change the logo url. I have tried this code in my child theme function.php file but it is not working:
```
function change_logo_url_animacao($html) {... | It's possible to have them share the same slug, but you need to manually resolve conflicts yourself. You have to check if the end of the requested URL is an existing term, and reset the query vars accordingly if it's not found:
```
function wpd_post_request_filter( $request ){
if( array_key_exists( 'category_name'... |
323,338 | <p>I am working on this jQuery which will eventually populate fields from the Parent field (Features) to the Children fields (Description, address, etc.) within a List Field. I have been able to get the fields to populate in a certain column, but when I change the first row parent, it changes the children field in all... | [
{
"answer_id": 323301,
"author": "Jacob Peattie",
"author_id": 39152,
"author_profile": "https://wordpress.stackexchange.com/users/39152",
"pm_score": -1,
"selected": false,
"text": "<p>The problem with what you're trying to do is that with your desired structure it's impossible to tell ... | 2018/12/18 | [
"https://wordpress.stackexchange.com/questions/323338",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/146177/"
] | I am working on this jQuery which will eventually populate fields from the Parent field (Features) to the Children fields (Description, address, etc.) within a List Field. I have been able to get the fields to populate in a certain column, but when I change the first row parent, it changes the children field in all the... | It's possible to have them share the same slug, but you need to manually resolve conflicts yourself. You have to check if the end of the requested URL is an existing term, and reset the query vars accordingly if it's not found:
```
function wpd_post_request_filter( $request ){
if( array_key_exists( 'category_name'... |
323,339 | <p>Disclaimer: I'm rubbish at PHP, so please bear with me as I'm still learning. I'm getting the PHP error <code>Array to string conversion</code> for the following code:</p>
<pre><code>function osu_add_role_to_body($classes = '') {
$current_user = new WP_User(get_current_user_id());
$user_role = array_... | [
{
"answer_id": 323399,
"author": "Osu",
"author_id": 2685,
"author_profile": "https://wordpress.stackexchange.com/users/2685",
"pm_score": 0,
"selected": false,
"text": "<p>I found that the problem was I was not checking if the user was logged in before adding the class. Here's my workin... | 2018/12/18 | [
"https://wordpress.stackexchange.com/questions/323339",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/2685/"
] | Disclaimer: I'm rubbish at PHP, so please bear with me as I'm still learning. I'm getting the PHP error `Array to string conversion` for the following code:
```
function osu_add_role_to_body($classes = '') {
$current_user = new WP_User(get_current_user_id());
$user_role = array_shift($current_user->role... | This code works and is perfectly valid, running on 7.3, except when your user has two roles:
```
add_filter( 'body_class', function( $classes = '' ) {
$current_user = new \WP_User(get_current_user_id());
$user_role = ['administrator', 'moderator']; //just a test, but this is what it'll look like if it h... |
323,354 | <p>I have created a custom image taxonomy field in WordPress using CMB2. I cannot get the images to display for website visitors even though my code uses <strong>get_term_meta</strong>. (The taxonomy images are amenity icons such as WiFi, shower head, electricity etc). </p>
<p>What am I doing wrong?</p>
<p>Relevant (... | [
{
"answer_id": 323399,
"author": "Osu",
"author_id": 2685,
"author_profile": "https://wordpress.stackexchange.com/users/2685",
"pm_score": 0,
"selected": false,
"text": "<p>I found that the problem was I was not checking if the user was logged in before adding the class. Here's my workin... | 2018/12/19 | [
"https://wordpress.stackexchange.com/questions/323354",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | I have created a custom image taxonomy field in WordPress using CMB2. I cannot get the images to display for website visitors even though my code uses **get\_term\_meta**. (The taxonomy images are amenity icons such as WiFi, shower head, electricity etc).
What am I doing wrong?
Relevant (not working) code in single-... | This code works and is perfectly valid, running on 7.3, except when your user has two roles:
```
add_filter( 'body_class', function( $classes = '' ) {
$current_user = new \WP_User(get_current_user_id());
$user_role = ['administrator', 'moderator']; //just a test, but this is what it'll look like if it h... |
323,361 | <p>I want to show the <strong>"last updated date"</strong> on the front of the post and page.<br>
so I add the following code in the functions.php file.<br></p>
<pre><code>function wpb_last_updated_date( $content ) {
$u_time = get_the_time('U');
$u_modified_time = get_the_modified_time('U');
if ($u_modified_time >=... | [
{
"answer_id": 323428,
"author": "scytale",
"author_id": 128374,
"author_profile": "https://wordpress.stackexchange.com/users/128374",
"pm_score": 2,
"selected": true,
"text": "<p>You can check for your \"home page\" at the start of your function by using <code>is_home()</code> and/or <c... | 2018/12/19 | [
"https://wordpress.stackexchange.com/questions/323361",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/157283/"
] | I want to show the **"last updated date"** on the front of the post and page.
so I add the following code in the functions.php file.
```
function wpb_last_updated_date( $content ) {
$u_time = get_the_time('U');
$u_modified_time = get_the_modified_time('U');
if ($u_modified_time >= $u_time + 86400) {
$updated_date... | You can check for your "home page" at the start of your function by using `is_home()` and/or `is_front_page()` and just return original content without date. See [is\_home vs is\_front\_page](https://wordpress.stackexchange.com/questions/30385/when-to-use-is-home-vs-is-front-page)
```
function wpb_last_updated_date( $... |
323,380 | <p>I have a WordPress website which was working good before WordPress 5.0. after update to WordPress 5.0 I get an 404 error on loading resources. </p>
<pre><code>style.min-rtl.css:1 Failed to load resource: the server responded with a status of 404 (Not Found)
</code></pre>
<p>and the missing file address is :</p>
<... | [
{
"answer_id": 323392,
"author": "CRavon",
"author_id": 122086,
"author_profile": "https://wordpress.stackexchange.com/users/122086",
"pm_score": 0,
"selected": false,
"text": "<p>The name of the file in WP 5.0.1 is \"style-rtl.min.css\" and not \"style.min-rtl.css\". \nSo did you try to... | 2018/12/19 | [
"https://wordpress.stackexchange.com/questions/323380",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/109403/"
] | I have a WordPress website which was working good before WordPress 5.0. after update to WordPress 5.0 I get an 404 error on loading resources.
```
style.min-rtl.css:1 Failed to load resource: the server responded with a status of 404 (Not Found)
```
and the missing file address is :
```
http://example.com/wp-inclu... | First I tried to disable all plugins and change theme to the default WordPress theme and error is showing yet.
Then tried to install a new WordPress 5.0.1 and got 2 errors:
```
theme.min-rtl.css:1 Failed to load resource: the server responded with a status of 404 (Not Found)
style.min-rtl.css:1 Failed to load resourc... |
323,404 | <p>I have been looking around for the answer but did not find any.</p>
<p>I am creating an <code>iframe</code> payment gateway while the iframe is loaded inside the checkout page. My goal is once the customer clicks on a certain button, the function which validates that the customer has filled all the required input i... | [
{
"answer_id": 323425,
"author": "RiddleMeThis",
"author_id": 86845,
"author_profile": "https://wordpress.stackexchange.com/users/86845",
"pm_score": 2,
"selected": false,
"text": "<p>I ran into this a few times, I have yet to find a straight forward method of handling it. But here is w... | 2018/12/19 | [
"https://wordpress.stackexchange.com/questions/323404",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/147331/"
] | I have been looking around for the answer but did not find any.
I am creating an `iframe` payment gateway while the iframe is loaded inside the checkout page. My goal is once the customer clicks on a certain button, the function which validates that the customer has filled all the required input is triggered and if it... | I ran into this a few times, I have yet to find a straight forward method of handling it. But here is what I've done in the past.
You can trigger checkout validation easily by forcing a click on the submit button.
```
$('#myButton').on('click', function(){
$('#place_order').click();
});
```
However,... |
323,408 | <p>I tried:</p>
<pre><code> wp_update_term($personid, 'category', array(
'name' => $_POST['nameChange'],
'slug' => $string,
'_city' => $_POST['newDob'],
));
</code></pre>
<p>Where <code>_city</code> is my category custom fie... | [
{
"answer_id": 323425,
"author": "RiddleMeThis",
"author_id": 86845,
"author_profile": "https://wordpress.stackexchange.com/users/86845",
"pm_score": 2,
"selected": false,
"text": "<p>I ran into this a few times, I have yet to find a straight forward method of handling it. But here is w... | 2018/12/19 | [
"https://wordpress.stackexchange.com/questions/323408",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/26593/"
] | I tried:
```
wp_update_term($personid, 'category', array(
'name' => $_POST['nameChange'],
'slug' => $string,
'_city' => $_POST['newDob'],
));
```
Where `_city` is my category custom field.
This is how I retrieve it:
```
$fields =... | I ran into this a few times, I have yet to find a straight forward method of handling it. But here is what I've done in the past.
You can trigger checkout validation easily by forcing a click on the submit button.
```
$('#myButton').on('click', function(){
$('#place_order').click();
});
```
However,... |
323,436 | <p>Here is my code</p>
<pre><code>function cron_add_weekly( $schedules ) {
$schedules['seconds'] = array(
'interval' => 5,
'display' => __( '5 Seconds' )
);
return $schedules;
}
add_filter( 'cron_schedules', 'cron_add_weekly' );
register_activation_hook(__FILE__, 'my_activation');
func... | [
{
"answer_id": 323440,
"author": "RiddleMeThis",
"author_id": 86845,
"author_profile": "https://wordpress.stackexchange.com/users/86845",
"pm_score": 1,
"selected": false,
"text": "<p>Assuming your code above is correct (I didn't test it) it is important to note that wp-cron will only ru... | 2018/12/19 | [
"https://wordpress.stackexchange.com/questions/323436",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/157336/"
] | Here is my code
```
function cron_add_weekly( $schedules ) {
$schedules['seconds'] = array(
'interval' => 5,
'display' => __( '5 Seconds' )
);
return $schedules;
}
add_filter( 'cron_schedules', 'cron_add_weekly' );
register_activation_hook(__FILE__, 'my_activation');
function my_activation()... | OK, so I've tested your code and I'm pretty sure it can't run even once... And here's why...
If you'll take a look at [`wp_schedule_event`](https://core.trac.wordpress.org/browser/tags/5.0/src/wp-includes/cron.php#L97) you'll see this check at the top of the function:
```
if ( !isset( $schedules[$recurrence] ) )
... |
323,439 | <p>HOW do you Redirect buddypress login to EDIT tab not PROFILE tab on profile page?</p>
| [
{
"answer_id": 323440,
"author": "RiddleMeThis",
"author_id": 86845,
"author_profile": "https://wordpress.stackexchange.com/users/86845",
"pm_score": 1,
"selected": false,
"text": "<p>Assuming your code above is correct (I didn't test it) it is important to note that wp-cron will only ru... | 2018/12/19 | [
"https://wordpress.stackexchange.com/questions/323439",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/138327/"
] | HOW do you Redirect buddypress login to EDIT tab not PROFILE tab on profile page? | OK, so I've tested your code and I'm pretty sure it can't run even once... And here's why...
If you'll take a look at [`wp_schedule_event`](https://core.trac.wordpress.org/browser/tags/5.0/src/wp-includes/cron.php#L97) you'll see this check at the top of the function:
```
if ( !isset( $schedules[$recurrence] ) )
... |
323,494 | <p>I'm trying to enqueue a JS file (located at /js/example-script.js), just to get an alert on page load.</p>
<p>Can anyone tell me what I'm doing wrong?</p>
<p>In my example-script.js:</p>
<pre><code>jQuery(document).ready(function($) {
alert("hi");
});
</code></pre>
<p>And in my functions file:</p>
<pre><code>... | [
{
"answer_id": 323515,
"author": "CRavon",
"author_id": 122086,
"author_profile": "https://wordpress.stackexchange.com/users/122086",
"pm_score": 1,
"selected": false,
"text": "<p>Are you using a child theme ? In this case you have to use <code>get_stylesheet_directory_uri()</code> inste... | 2018/12/20 | [
"https://wordpress.stackexchange.com/questions/323494",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/121694/"
] | I'm trying to enqueue a JS file (located at /js/example-script.js), just to get an alert on page load.
Can anyone tell me what I'm doing wrong?
In my example-script.js:
```
jQuery(document).ready(function($) {
alert("hi");
});
```
And in my functions file:
```
function my_theme_scripts() {
wp_enqueue_script... | Are you using a child theme ? In this case you have to use `get_stylesheet_directory_uri()` instead of `get_stylesheet_template_uri()`which returns the parent theme uri
<https://developer.wordpress.org/reference/functions/get_template_directory/#usage> |
323,506 | <p>I am trying to allow gedcom file uploads. These files have a .ged extension.</p>
<p>Gedcom files do not have a mime type. </p>
<p>I have tried the following code with various text/types such as csv, rtf etc without success.</p>
<pre><code> function my_mime_types($mime_types){
$mime_types['ged'] = 'text/csv';
... | [
{
"answer_id": 323522,
"author": "Md. Ehsanul Haque Kanan",
"author_id": 75705,
"author_profile": "https://wordpress.stackexchange.com/users/75705",
"pm_score": -1,
"selected": false,
"text": "<p>I think that there is a conflict between your theme and another plugin. In other words, ther... | 2018/12/20 | [
"https://wordpress.stackexchange.com/questions/323506",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/36113/"
] | I am trying to allow gedcom file uploads. These files have a .ged extension.
Gedcom files do not have a mime type.
I have tried the following code with various text/types such as csv, rtf etc without success.
```
function my_mime_types($mime_types){
$mime_types['ged'] = 'text/csv';
return $mime_types;}
add_... | This is a know issue with WP Update 5.02.
View the topic [HERE](https://github.com/woocommerce/woocommerce/issues/22271).
And the fix [HERE](https://github.com/woocommerce/woocommerce/pull/22273). |
323,539 | <p>I'm trying to load external content into an iframe, & it is working in Chrome & Firefox, but it won't load in Safari. In Safari I get the error message:</p>
<blockquote>
<p>Refused to display 'my_content' in a frame because it set
'X-Frame-Options' to 'sameorigin'</p>
</blockquote>
<p>I think the issue... | [
{
"answer_id": 323522,
"author": "Md. Ehsanul Haque Kanan",
"author_id": 75705,
"author_profile": "https://wordpress.stackexchange.com/users/75705",
"pm_score": -1,
"selected": false,
"text": "<p>I think that there is a conflict between your theme and another plugin. In other words, ther... | 2018/12/20 | [
"https://wordpress.stackexchange.com/questions/323539",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/73347/"
] | I'm trying to load external content into an iframe, & it is working in Chrome & Firefox, but it won't load in Safari. In Safari I get the error message:
>
> Refused to display 'my\_content' in a frame because it set
> 'X-Frame-Options' to 'sameorigin'
>
>
>
I think the issue may be that my WordPress install is i... | This is a know issue with WP Update 5.02.
View the topic [HERE](https://github.com/woocommerce/woocommerce/issues/22271).
And the fix [HERE](https://github.com/woocommerce/woocommerce/pull/22273). |
323,562 | <p>This theme I was handed from another dev company is littered with <code>add_action/filter( 'hook/filter', create_function( '', 'return blah('blah')' );</code> We will be moving this site to a server running <code>php 7.2</code>.</p>
<p>I am wondering what's the appropriate method to remove these actions and filters... | [
{
"answer_id": 323564,
"author": "Tom J Nowell",
"author_id": 736,
"author_profile": "https://wordpress.stackexchange.com/users/736",
"pm_score": 1,
"selected": false,
"text": "<p>In order to remove the hooks and filters, we need to be able to get a reference to the callable that was add... | 2018/12/20 | [
"https://wordpress.stackexchange.com/questions/323562",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/157435/"
] | This theme I was handed from another dev company is littered with `add_action/filter( 'hook/filter', create_function( '', 'return blah('blah')' );` We will be moving this site to a server running `php 7.2`.
I am wondering what's the appropriate method to remove these actions and filters. Or can I simply just copy and ... | In order to remove the hooks and filters, we need to be able to get a reference to the callable that was added, but in this case, `create_function` was used, so that's extremely difficult. It's also the reason you're getting deprecation notices. Sadly the only way to fix those deprecations is to change the parent theme... |
323,603 | <p>By default wooCommerce displays price as "Regular price" first and "Sale price" second. I wish to reverse the order for all types (simple,variation,...). Is this possible? How?</p>
<p>Thx</p>
| [
{
"answer_id": 323564,
"author": "Tom J Nowell",
"author_id": 736,
"author_profile": "https://wordpress.stackexchange.com/users/736",
"pm_score": 1,
"selected": false,
"text": "<p>In order to remove the hooks and filters, we need to be able to get a reference to the callable that was add... | 2018/12/21 | [
"https://wordpress.stackexchange.com/questions/323603",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/28159/"
] | By default wooCommerce displays price as "Regular price" first and "Sale price" second. I wish to reverse the order for all types (simple,variation,...). Is this possible? How?
Thx | In order to remove the hooks and filters, we need to be able to get a reference to the callable that was added, but in this case, `create_function` was used, so that's extremely difficult. It's also the reason you're getting deprecation notices. Sadly the only way to fix those deprecations is to change the parent theme... |
323,630 | <p>I want to export some specific posts from my database (csv or sql) and then replace content to these and import them back without changing the id number of the posts.I s this possible to do it and if it is, how?</p>
<p>Thank you in advance. </p>
| [
{
"answer_id": 323564,
"author": "Tom J Nowell",
"author_id": 736,
"author_profile": "https://wordpress.stackexchange.com/users/736",
"pm_score": 1,
"selected": false,
"text": "<p>In order to remove the hooks and filters, we need to be able to get a reference to the callable that was add... | 2018/12/21 | [
"https://wordpress.stackexchange.com/questions/323630",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/129970/"
] | I want to export some specific posts from my database (csv or sql) and then replace content to these and import them back without changing the id number of the posts.I s this possible to do it and if it is, how?
Thank you in advance. | In order to remove the hooks and filters, we need to be able to get a reference to the callable that was added, but in this case, `create_function` was used, so that's extremely difficult. It's also the reason you're getting deprecation notices. Sadly the only way to fix those deprecations is to change the parent theme... |
323,637 | <p>I would like to understand the best practices regarding nonce validation in REST APIs.</p>
<p>I see a lot of people talking about <code>wp_rest</code> nonce for REST requests. But upon looking on WordPress core code, I saw that <code>wp_rest</code> is just a nonce to validate a logged in user status, if it's not pr... | [
{
"answer_id": 323638,
"author": "Lucas Bustamante",
"author_id": 27278,
"author_profile": "https://wordpress.stackexchange.com/users/27278",
"pm_score": 4,
"selected": false,
"text": "<p>You should pass the special <code>wp_rest</code> nonce as part of the request. Without it, the <code... | 2018/12/22 | [
"https://wordpress.stackexchange.com/questions/323637",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/27278/"
] | I would like to understand the best practices regarding nonce validation in REST APIs.
I see a lot of people talking about `wp_rest` nonce for REST requests. But upon looking on WordPress core code, I saw that `wp_rest` is just a nonce to validate a logged in user status, if it's not present, it just runs the request ... | You should pass the special `wp_rest` nonce as part of the request. Without it, the `global $current_user` object will not be available in your REST class. You can pass this from several ways, from $\_GET to $\_POST to headers.
The action nonce is optional. If you add it, you can't use the REST endpoint from an extern... |
323,705 | <p>I have used this function to add a responsive class to all the images in content but this breaks the html structure of the website. This wraps the content with :
<code><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"><body> the content goes here (... | [
{
"answer_id": 323638,
"author": "Lucas Bustamante",
"author_id": 27278,
"author_profile": "https://wordpress.stackexchange.com/users/27278",
"pm_score": 4,
"selected": false,
"text": "<p>You should pass the special <code>wp_rest</code> nonce as part of the request. Without it, the <code... | 2018/12/22 | [
"https://wordpress.stackexchange.com/questions/323705",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | I have used this function to add a responsive class to all the images in content but this breaks the html structure of the website. This wraps the content with :
`<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"><body> the content goes here (output from the_conte... | You should pass the special `wp_rest` nonce as part of the request. Without it, the `global $current_user` object will not be available in your REST class. You can pass this from several ways, from $\_GET to $\_POST to headers.
The action nonce is optional. If you add it, you can't use the REST endpoint from an extern... |
323,713 | <p>I am looking for a good approach regarding the creation of custom post types in WordPress, using object orientation. How can I create CPTs in an clean, organized way?</p>
<p>Take into consideration these 3 scenarios:</p>
<ol>
<li>Plugin for distribution (5.2 compatible)</li>
<li>Theme for distribution</li>
<li>Own... | [
{
"answer_id": 323714,
"author": "Lucas Bustamante",
"author_id": 27278,
"author_profile": "https://wordpress.stackexchange.com/users/27278",
"pm_score": 3,
"selected": false,
"text": "<p>I'll answer <strong>scenario #3</strong>, even though it can be adapted for scenarios #1 and #2, too... | 2018/12/22 | [
"https://wordpress.stackexchange.com/questions/323713",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/27278/"
] | I am looking for a good approach regarding the creation of custom post types in WordPress, using object orientation. How can I create CPTs in an clean, organized way?
Take into consideration these 3 scenarios:
1. Plugin for distribution (5.2 compatible)
2. Theme for distribution
3. Own project, with total control ove... | I'll answer **scenario #3**, even though it can be adapted for scenarios #1 and #2, too.
WordPress codex [recommends](https://codex.wordpress.org/Post_Types#A_word_about_custom_post_types_as_a_plugin) that we create Custom Post Types (CPTs) in a plugin. Following that recommendation, I will write my answer using moder... |
323,715 | <p>I have two categories for my posts, "event" and "long-term-leasing." I have sidebar-events.php and sidebar-long-term.php. I wrote a conditional statement in single.php, but when I view a post it only shows me the generic sidebar. I did a copy/paste of the categories to avoid typos. Where is my mistake?</p>
<pre><co... | [
{
"answer_id": 323714,
"author": "Lucas Bustamante",
"author_id": 27278,
"author_profile": "https://wordpress.stackexchange.com/users/27278",
"pm_score": 3,
"selected": false,
"text": "<p>I'll answer <strong>scenario #3</strong>, even though it can be adapted for scenarios #1 and #2, too... | 2018/12/22 | [
"https://wordpress.stackexchange.com/questions/323715",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/157494/"
] | I have two categories for my posts, "event" and "long-term-leasing." I have sidebar-events.php and sidebar-long-term.php. I wrote a conditional statement in single.php, but when I view a post it only shows me the generic sidebar. I did a copy/paste of the categories to avoid typos. Where is my mistake?
```
<?php
... | I'll answer **scenario #3**, even though it can be adapted for scenarios #1 and #2, too.
WordPress codex [recommends](https://codex.wordpress.org/Post_Types#A_word_about_custom_post_types_as_a_plugin) that we create Custom Post Types (CPTs) in a plugin. Following that recommendation, I will write my answer using moder... |
323,737 | <p>my theme has option that there is a button in each post that I can give it a link. But I want to open a modal with clicking on this button and be able to modify the modal in each post. It means each post a special modal. Is it possible?</p>
| [
{
"answer_id": 323714,
"author": "Lucas Bustamante",
"author_id": 27278,
"author_profile": "https://wordpress.stackexchange.com/users/27278",
"pm_score": 3,
"selected": false,
"text": "<p>I'll answer <strong>scenario #3</strong>, even though it can be adapted for scenarios #1 and #2, too... | 2018/12/23 | [
"https://wordpress.stackexchange.com/questions/323737",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/157582/"
] | my theme has option that there is a button in each post that I can give it a link. But I want to open a modal with clicking on this button and be able to modify the modal in each post. It means each post a special modal. Is it possible? | I'll answer **scenario #3**, even though it can be adapted for scenarios #1 and #2, too.
WordPress codex [recommends](https://codex.wordpress.org/Post_Types#A_word_about_custom_post_types_as_a_plugin) that we create Custom Post Types (CPTs) in a plugin. Following that recommendation, I will write my answer using moder... |
323,750 | <p>To allow extra file types for upload, we use:</p>
<pre><code>add_filter('mime_types', 'my_mimes');
function my_mimes($all)
{
$all['zip'] = 'application/zip';
return $all;
}
</code></pre>
<p>But how to assign multiple file types to 1 extension?
For example, <code>zip</code> extension might have <code>applic... | [
{
"answer_id": 323757,
"author": "birgire",
"author_id": 26350,
"author_profile": "https://wordpress.stackexchange.com/users/26350",
"pm_score": 4,
"selected": true,
"text": "<p>Note the stricter mime type check since WP 5.0.1 where the file content and file extension must match. See e.g... | 2018/12/23 | [
"https://wordpress.stackexchange.com/questions/323750",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/33667/"
] | To allow extra file types for upload, we use:
```
add_filter('mime_types', 'my_mimes');
function my_mimes($all)
{
$all['zip'] = 'application/zip';
return $all;
}
```
But how to assign multiple file types to 1 extension?
For example, `zip` extension might have `application/zip` mime and also `application/x-zi... | Note the stricter mime type check since WP 5.0.1 where the file content and file extension must match. See e.g. this recent [question](https://wordpress.stackexchange.com/q/321804/26350) on the `vtt` file type.
Secondary mime type for a given file extension
----------------------------------------------
Here's a sugg... |
323,760 | <p>I am able to create a new post but I get a generic error message <code>Publishing failed</code> if I try to publish it. Same thing if I try to edit it (or any other post).
If I try to delete the post using the <code>Move to trash</code> button, I get another error: <code>The response is not a valid JSON response.</c... | [
{
"answer_id": 323757,
"author": "birgire",
"author_id": 26350,
"author_profile": "https://wordpress.stackexchange.com/users/26350",
"pm_score": 4,
"selected": true,
"text": "<p>Note the stricter mime type check since WP 5.0.1 where the file content and file extension must match. See e.g... | 2018/12/23 | [
"https://wordpress.stackexchange.com/questions/323760",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/60539/"
] | I am able to create a new post but I get a generic error message `Publishing failed` if I try to publish it. Same thing if I try to edit it (or any other post).
If I try to delete the post using the `Move to trash` button, I get another error: `The response is not a valid JSON response.`
The issue only happens in the ... | Note the stricter mime type check since WP 5.0.1 where the file content and file extension must match. See e.g. this recent [question](https://wordpress.stackexchange.com/q/321804/26350) on the `vtt` file type.
Secondary mime type for a given file extension
----------------------------------------------
Here's a sugg... |
323,771 | <p>I've been looking for the whole day for a plugin that help me to solve my problem with my website.</p>
<p>Is there a way to create a specific form that could send a custom e-mail when the user complete it? </p>
<p>Thanks!</p>
| [
{
"answer_id": 323757,
"author": "birgire",
"author_id": 26350,
"author_profile": "https://wordpress.stackexchange.com/users/26350",
"pm_score": 4,
"selected": true,
"text": "<p>Note the stricter mime type check since WP 5.0.1 where the file content and file extension must match. See e.g... | 2018/12/23 | [
"https://wordpress.stackexchange.com/questions/323771",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/148532/"
] | I've been looking for the whole day for a plugin that help me to solve my problem with my website.
Is there a way to create a specific form that could send a custom e-mail when the user complete it?
Thanks! | Note the stricter mime type check since WP 5.0.1 where the file content and file extension must match. See e.g. this recent [question](https://wordpress.stackexchange.com/q/321804/26350) on the `vtt` file type.
Secondary mime type for a given file extension
----------------------------------------------
Here's a sugg... |
323,807 | <p>I have recently decided it would be best if i disable the built in wordpress cron function and move to the system cron which will activate the wordpress cron every 15 minutes. </p>
<p>I am wondering which way is best and what the differences are performance wise etc?</p>
<p>The two ways I have seen this done are:<... | [
{
"answer_id": 323757,
"author": "birgire",
"author_id": 26350,
"author_profile": "https://wordpress.stackexchange.com/users/26350",
"pm_score": 4,
"selected": true,
"text": "<p>Note the stricter mime type check since WP 5.0.1 where the file content and file extension must match. See e.g... | 2018/12/24 | [
"https://wordpress.stackexchange.com/questions/323807",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/157634/"
] | I have recently decided it would be best if i disable the built in wordpress cron function and move to the system cron which will activate the wordpress cron every 15 minutes.
I am wondering which way is best and what the differences are performance wise etc?
The two ways I have seen this done are:
```
curl http://... | Note the stricter mime type check since WP 5.0.1 where the file content and file extension must match. See e.g. this recent [question](https://wordpress.stackexchange.com/q/321804/26350) on the `vtt` file type.
Secondary mime type for a given file extension
----------------------------------------------
Here's a sugg... |
323,927 | <p>I'm looking to customize the "There is a new version of XYZ available." text on the Plugins list page. I know the code is in <a href="https://github.com/WordPress/WordPress/blob/56c162fbc9867f923862f64f1b4570d885f1ff03/wp-admin/includes/update.php#L592" rel="noreferrer">wp-admin/includes/update.php</a>, however I'm ... | [
{
"answer_id": 323929,
"author": "Jory Hogeveen",
"author_id": 99325,
"author_profile": "https://wordpress.stackexchange.com/users/99325",
"pm_score": 0,
"selected": false,
"text": "<p>This text can't be filtered afaik.\nYou can append text though: <a href=\"https://developer.wordpress.o... | 2018/12/26 | [
"https://wordpress.stackexchange.com/questions/323927",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/157755/"
] | I'm looking to customize the "There is a new version of XYZ available." text on the Plugins list page. I know the code is in [wp-admin/includes/update.php](https://github.com/WordPress/WordPress/blob/56c162fbc9867f923862f64f1b4570d885f1ff03/wp-admin/includes/update.php#L592), however I'm not certain how to call this ou... | Since the text is processed by `_()` function, then, of course, you can modify it using [`gettext`](https://codex.wordpress.org/Plugin_API/Filter_Reference/gettext) filter.
```
function change_update_notification_msg( $translated_text, $untranslated_text, $domain )
{
if ( is_admin() ) {
$texts = array(
... |
323,932 | <p>I'm using a theme for my WordPress which uses 'Raleway' and it requests (13 requests in gtmetrix waterfall) it from Google fonts API. I want to keep using the font. However, I'm trying to reduce the number of requests and the size of my page. Can I include/integrate the fonts on my website so the browser won't have ... | [
{
"answer_id": 323929,
"author": "Jory Hogeveen",
"author_id": 99325,
"author_profile": "https://wordpress.stackexchange.com/users/99325",
"pm_score": 0,
"selected": false,
"text": "<p>This text can't be filtered afaik.\nYou can append text though: <a href=\"https://developer.wordpress.o... | 2018/12/26 | [
"https://wordpress.stackexchange.com/questions/323932",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/157759/"
] | I'm using a theme for my WordPress which uses 'Raleway' and it requests (13 requests in gtmetrix waterfall) it from Google fonts API. I want to keep using the font. However, I'm trying to reduce the number of requests and the size of my page. Can I include/integrate the fonts on my website so the browser won't have to ... | Since the text is processed by `_()` function, then, of course, you can modify it using [`gettext`](https://codex.wordpress.org/Plugin_API/Filter_Reference/gettext) filter.
```
function change_update_notification_msg( $translated_text, $untranslated_text, $domain )
{
if ( is_admin() ) {
$texts = array(
... |
324,008 | <p>Previously Chrome, Firefox, Edge, and other browsers showed <a href="https://wisconsinwetlands.org" rel="nofollow noreferrer">our site</a> as fully SSL/HTTPS secure. For some reason, they now warn about mixed content.</p>
<p>But the content in question seems to be secure.</p>
<p>This only affects a subset of the i... | [
{
"answer_id": 324009,
"author": "Krzysiek Dróżdż",
"author_id": 34172,
"author_profile": "https://wordpress.stackexchange.com/users/34172",
"pm_score": 2,
"selected": false,
"text": "<p>301 redirects are the reason.</p>\n\n<p>In your site you have this image:</p>\n\n<p><code>https://www... | 2018/12/27 | [
"https://wordpress.stackexchange.com/questions/324008",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3864/"
] | Previously Chrome, Firefox, Edge, and other browsers showed [our site](https://wisconsinwetlands.org) as fully SSL/HTTPS secure. For some reason, they now warn about mixed content.
But the content in question seems to be secure.
This only affects a subset of the images on each page. Here's one example—a footer image.... | You have "www.wisconsinwetlands.org" URLs redirecting to insecure "<http://wisconsinwetlands.org>".
The cases you have used these is in the images on the page. Every image that is set as "<https://www>." redirects to the insecure version.
So while you do need to fix that and correctly configure your setup so that bot... |
324,043 | <p>I am trying to remove two links from users dashboard keeping it on admin but it goes off on both user and admin.</p>
<p>One i need to remove from user dashboard and other is contact form plugin link contact.</p>
<p>I am trying t o use below code.also post link goes off.</p>
<pre><code> add_filter( 'admin_men... | [
{
"answer_id": 324009,
"author": "Krzysiek Dróżdż",
"author_id": 34172,
"author_profile": "https://wordpress.stackexchange.com/users/34172",
"pm_score": 2,
"selected": false,
"text": "<p>301 redirects are the reason.</p>\n\n<p>In your site you have this image:</p>\n\n<p><code>https://www... | 2018/12/28 | [
"https://wordpress.stackexchange.com/questions/324043",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/157850/"
] | I am trying to remove two links from users dashboard keeping it on admin but it goes off on both user and admin.
One i need to remove from user dashboard and other is contact form plugin link contact.
I am trying t o use below code.also post link goes off.
```
add_filter( 'admin_menu', 'remove_menus', 99 );
... | You have "www.wisconsinwetlands.org" URLs redirecting to insecure "<http://wisconsinwetlands.org>".
The cases you have used these is in the images on the page. Every image that is set as "<https://www>." redirects to the insecure version.
So while you do need to fix that and correctly configure your setup so that bot... |
324,051 | <p>I would like to add <code>edit.php</code> to user dashboard who registers as subscriber on a website. Code which i using is </p>
<pre><code>add_action( 'admin_menu', 'remove_menus' );
function remove_menus(){
if(!current_user_can('subscriber'))
add_menu_page( 'edit.php' ); //dashboard
}
</code></pre>
<p>even h... | [
{
"answer_id": 324053,
"author": "Pratik bhatt",
"author_id": 60922,
"author_profile": "https://wordpress.stackexchange.com/users/60922",
"pm_score": 0,
"selected": false,
"text": "<p>Please update the code as below </p>\n\n<pre><code>add_action( 'admin_menu', 'remove_menus' );\nfunction... | 2018/12/28 | [
"https://wordpress.stackexchange.com/questions/324051",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/157850/"
] | I would like to add `edit.php` to user dashboard who registers as subscriber on a website. Code which i using is
```
add_action( 'admin_menu', 'remove_menus' );
function remove_menus(){
if(!current_user_can('subscriber'))
add_menu_page( 'edit.php' ); //dashboard
}
```
even has administrator instead subscriber d... | Please update the code as below
```
add_action( 'admin_menu', 'remove_menus' );
function remove_menus(){
$user = wp_get_current_user();
$role = ( array ) $user->roles;
if($role[0]==subscriber)
add_menu_page( 'edit.php' ); //dashboard
```
} |
324,077 | <p>I have disabled the registered users to select the admin color scheme as I want all of them to use the 'Coffee' scheme. I have also made the 'Coffee' color scheme the default one for registered users. </p>
<p>However, WordPress still shows the default (black) admin bar for nonregistered/nonlogged users of the websi... | [
{
"answer_id": 324053,
"author": "Pratik bhatt",
"author_id": 60922,
"author_profile": "https://wordpress.stackexchange.com/users/60922",
"pm_score": 0,
"selected": false,
"text": "<p>Please update the code as below </p>\n\n<pre><code>add_action( 'admin_menu', 'remove_menus' );\nfunction... | 2018/12/28 | [
"https://wordpress.stackexchange.com/questions/324077",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/110642/"
] | I have disabled the registered users to select the admin color scheme as I want all of them to use the 'Coffee' scheme. I have also made the 'Coffee' color scheme the default one for registered users.
However, WordPress still shows the default (black) admin bar for nonregistered/nonlogged users of the website.
Do yo... | Please update the code as below
```
add_action( 'admin_menu', 'remove_menus' );
function remove_menus(){
$user = wp_get_current_user();
$role = ( array ) $user->roles;
if($role[0]==subscriber)
add_menu_page( 'edit.php' ); //dashboard
```
} |