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 |
|---|---|---|---|---|---|---|
255,142 | <p>I have an apache config where I whitelist IPs to a non-WordPress subfolder like this:</p>
<pre><code><Directory /var/www/html/link>
Order allow,deny
Require all granted
#Our Network
Allow from ip-address/22
Allow from ip-address/24
Allow from ip-address/24
Allow from ip-address/24
#and even longer list of IP... | [
{
"answer_id": 255652,
"author": "T.Todua",
"author_id": 33667,
"author_profile": "https://wordpress.stackexchange.com/users/33667",
"pm_score": 0,
"selected": false,
"text": "<p>As far as I know, .htaccess (or apache config) is prioritized and you cant override it easily. There are two ... | 2017/02/04 | [
"https://wordpress.stackexchange.com/questions/255142",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1264/"
] | I have an apache config where I whitelist IPs to a non-WordPress subfolder like this:
```
<Directory /var/www/html/link>
Order allow,deny
Require all granted
#Our Network
Allow from ip-address/22
Allow from ip-address/24
Allow from ip-address/24
Allow from ip-address/24
#and even longer list of IPs and other folders
... | Simple & Fast but not 100% secure method:
=========================================
This method is not 100% secure, but for most users (like 99%), it'll work.
Here, basically you'll use a `.htaccess` file ***inside the restricted directory***, say: `/var/www/html/link` with the following CODE:
```
SetEnvIf Cooki... |
255,148 | <p>So I have a website which is made by using Wordpress platform. I'm completely unaware of SEO and when I search for my website on Google the description is something like this </p>
<blockquote>
<p>A description for this result is not available because of this site's robots.txt</p>
</blockquote>
<p>My Wordpress ro... | [
{
"answer_id": 255211,
"author": "KAGG Design",
"author_id": 108721,
"author_profile": "https://wordpress.stackexchange.com/users/108721",
"pm_score": 1,
"selected": false,
"text": "<p>Content of robots.txt is right. Site should be indexed. Probably some time ago indexation was prohibite... | 2017/02/04 | [
"https://wordpress.stackexchange.com/questions/255148",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/112529/"
] | So I have a website which is made by using Wordpress platform. I'm completely unaware of SEO and when I search for my website on Google the description is something like this
>
> A description for this result is not available because of this site's robots.txt
>
>
>
My Wordpress robots.txt file content is as foll... | Content of robots.txt is right. Site should be indexed. Probably some time ago indexation was prohibited in WordPress settings.
What you can do, request re-indexing of your site in Google Search Console and in some time (one week maybe) you can see usual description of your pages in Google search results. |
255,151 | <p>This is probably a silly question. Could someone potentially use a short code injection attack?</p>
<p>What is stopping someone from injecting something like this? </p>
<pre><code>[shortcode]Do something[/shortcode]
</code></pre>
<p>I am sure that WP already thought about this but I am just wondering, what securi... | [
{
"answer_id": 255153,
"author": "Mark Kaplun",
"author_id": 23970,
"author_profile": "https://wordpress.stackexchange.com/users/23970",
"pm_score": 2,
"selected": false,
"text": "<ol>\n<li><p>In general, like with any other theme or plugin on your system, there is nothing built-in that ... | 2017/02/04 | [
"https://wordpress.stackexchange.com/questions/255151",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/70197/"
] | This is probably a silly question. Could someone potentially use a short code injection attack?
What is stopping someone from injecting something like this?
```
[shortcode]Do something[/shortcode]
```
I am sure that WP already thought about this but I am just wondering, what security mechanism stops this type of i... | 1. In general, like with any other theme or plugin on your system, there is nothing built-in that can prevent all attack vectors
2. Shortcodes are a kind of macros for generating HTML. Shortcodes that don't do more than that should generally be safe.
3. The biggest problem with shortcodes is that their insertion and "e... |
255,166 | <p>I want to manually eliminate render blocking in order to boost speed.</p>
<p>I've been searching for solution in google for past two days.</p>
<p>Tried below 3 solutions in functions.php. That indeed worked however....</p>
<ol>
<li>eliminated from half js scripts and i still get the same message for other js.</li... | [
{
"answer_id": 255153,
"author": "Mark Kaplun",
"author_id": 23970,
"author_profile": "https://wordpress.stackexchange.com/users/23970",
"pm_score": 2,
"selected": false,
"text": "<ol>\n<li><p>In general, like with any other theme or plugin on your system, there is nothing built-in that ... | 2017/02/04 | [
"https://wordpress.stackexchange.com/questions/255166",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/86147/"
] | I want to manually eliminate render blocking in order to boost speed.
I've been searching for solution in google for past two days.
Tried below 3 solutions in functions.php. That indeed worked however....
1. eliminated from half js scripts and i still get the same message for other js.
2. did not eliminate from CSS
... | 1. In general, like with any other theme or plugin on your system, there is nothing built-in that can prevent all attack vectors
2. Shortcodes are a kind of macros for generating HTML. Shortcodes that don't do more than that should generally be safe.
3. The biggest problem with shortcodes is that their insertion and "e... |
255,170 | <p>I have a plugin which uses <code>wp_remote_get()</code> and it's not working on my nginx server so I decided to test this. </p>
<p>I created a file called <code>test.php</code> and inserted:</p>
<pre><code><?php $response = wp_remote_get( 'http://www.domain.com/mytest.php' );
print $response ['body']; ?>
</... | [
{
"answer_id": 255174,
"author": "Nathan Johnson",
"author_id": 106269,
"author_profile": "https://wordpress.stackexchange.com/users/106269",
"pm_score": 1,
"selected": false,
"text": "<p>Are you trying to access your test.php file directly? If so, then WordPress won't be loaded, so <cod... | 2017/02/04 | [
"https://wordpress.stackexchange.com/questions/255170",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/40727/"
] | I have a plugin which uses `wp_remote_get()` and it's not working on my nginx server so I decided to test this.
I created a file called `test.php` and inserted:
```
<?php $response = wp_remote_get( 'http://www.domain.com/mytest.php' );
print $response ['body']; ?>
```
When I run this file I am getting error:
```... | The very concept of HTTP API is to make sure transport will be done. It basically uses 5 different transport methods and it chooses the best one according to your server config. So it's unlikely a compatibility issue with `wp_remote_get()` and your server.
Plus if WP is not loaded, adding an action won't help, it will... |
255,193 | <p>we (my son and me) modified a script - '/js/sticky-menu.js' - and it only works when Cloudflare 'Rocket Loader' is off.</p>
<p>Following the <a href="https://support.cloudflare.com/hc/en-us/articles/200168056-What-does-Rocket-Loader-do-" rel="nofollow noreferrer">tutorial</a> for Rocket Loader I tried to exclude the... | [
{
"answer_id": 255231,
"author": "Scott",
"author_id": 111485,
"author_profile": "https://wordpress.stackexchange.com/users/111485",
"pm_score": 3,
"selected": true,
"text": "<h1>Solution:</h1>\n\n<p>Because the theme JavaScript is not in:</p>\n\n<pre><code>/js/sticky-menu.js\n</code></p... | 2017/02/04 | [
"https://wordpress.stackexchange.com/questions/255193",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/112048/"
] | we (my son and me) modified a script - '/js/sticky-menu.js' - and it only works when Cloudflare 'Rocket Loader' is off.
Following the [tutorial](https://support.cloudflare.com/hc/en-us/articles/200168056-What-does-Rocket-Loader-do-) for Rocket Loader I tried to exclude the script by adding this code into the header (u... | Solution:
=========
Because the theme JavaScript is not in:
```
/js/sticky-menu.js
```
Rather, it's in your theme folder (as your theme name is `lifestyle-pro`, as found from your site's HTML):
```
/wp-content/themes/lifestyle-pro/js/sticky-menu.js
```
So your `<script>` CODE should be:
```
<script data-cfasync... |
255,210 | <p>In my plugin, I have this statement</p>
<pre><code>add_filter( 'comment_edit_redirect', 'mcd_return_link');
</code></pre>
<p>and this function</p>
<pre><code>function mcd_return_link {
return "edit-comments.php";
}
</code></pre>
<p>Inside the <strong>comments.php</strong> (core file), is this section of code ... | [
{
"answer_id": 255214,
"author": "Nathan Johnson",
"author_id": 106269,
"author_profile": "https://wordpress.stackexchange.com/users/106269",
"pm_score": 1,
"selected": false,
"text": "<blockquote>\n <p>Why is the filter not being applied?</p>\n</blockquote>\n\n<p>Hard to say. Try addin... | 2017/02/04 | [
"https://wordpress.stackexchange.com/questions/255210",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/29416/"
] | In my plugin, I have this statement
```
add_filter( 'comment_edit_redirect', 'mcd_return_link');
```
and this function
```
function mcd_return_link {
return "edit-comments.php";
}
```
Inside the **comments.php** (core file), is this section of code (within the section to edit comments, around line 310) (versio... | An answer that brings up another question...
I had a sudden epiphany ... if the plugin is not active on site-1 or site-2, and you click on a link to a comment for site-2, you are taken to the comment editing screen.
But, since the plugin is not active on site-1/site-2 (even though 'network activated' in the multisite... |
255,260 | <p>There are a number of 3rd party wp.org repository plugins that 1) add categories and tags to pages, and 2) enable pages to be displayed along with posts in the archive pages.</p>
<p>The code they use for part 2 always uses:</p>
<pre><code>$wp_query->set
</code></pre>
<p>eg:</p>
<pre><code> if ( ! is_admin()... | [
{
"answer_id": 255266,
"author": "Ignacio Jose Canó Cabral",
"author_id": 69671,
"author_profile": "https://wordpress.stackexchange.com/users/69671",
"pm_score": 2,
"selected": false,
"text": "<p>If the code shown above is the one the plugin is using, it will affect every query, since it... | 2017/02/05 | [
"https://wordpress.stackexchange.com/questions/255260",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/112591/"
] | There are a number of 3rd party wp.org repository plugins that 1) add categories and tags to pages, and 2) enable pages to be displayed along with posts in the archive pages.
The code they use for part 2 always uses:
```
$wp_query->set
```
eg:
```
if ( ! is_admin() ) {
add_action( 'pre_get_posts', 'catego... | If the code shown above is the one the plugin is using, it will affect every query, since it's not checking for is\_main\_query() (<https://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts>)
What you could do, is remove the action, do your query, and then add the action again (if needed)
```
remove_actio... |
255,275 | <p>I'm looking to run a function 'catloop' after the content.
Instead of just placing it below the_content();
I wanted to do it the right way. There is also a social plugin that places some sharing function after all the content that I need to be above, so, I have a higher priority on the filter.
This is what I have i... | [
{
"answer_id": 255266,
"author": "Ignacio Jose Canó Cabral",
"author_id": 69671,
"author_profile": "https://wordpress.stackexchange.com/users/69671",
"pm_score": 2,
"selected": false,
"text": "<p>If the code shown above is the one the plugin is using, it will affect every query, since it... | 2017/02/05 | [
"https://wordpress.stackexchange.com/questions/255275",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/91267/"
] | I'm looking to run a function 'catloop' after the content.
Instead of just placing it below the\_content();
I wanted to do it the right way. There is also a social plugin that places some sharing function after all the content that I need to be above, so, I have a higher priority on the filter.
This is what I have in ... | If the code shown above is the one the plugin is using, it will affect every query, since it's not checking for is\_main\_query() (<https://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts>)
What you could do, is remove the action, do your query, and then add the action again (if needed)
```
remove_actio... |
255,276 | <p>I am trying to perform a WP_Query, passing the values for <code>before</code> and <code>after</code> in the <code>date_query</code> as unix timestamps.</p>
<p>This does not seem to work:</p>
<pre><code>$args = array(
'date_query' => array(
'before' => 1486045020
)
);
</code></pre>
<p>I know I could ... | [
{
"answer_id": 255279,
"author": "sdexp",
"author_id": 102830,
"author_profile": "https://wordpress.stackexchange.com/users/102830",
"pm_score": 0,
"selected": false,
"text": "<p>You can have a look at the blog database itself to see the exact format Wordpress stores dates in. It doesn't... | 2017/02/05 | [
"https://wordpress.stackexchange.com/questions/255276",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/9349/"
] | I am trying to perform a WP\_Query, passing the values for `before` and `after` in the `date_query` as unix timestamps.
This does not seem to work:
```
$args = array(
'date_query' => array(
'before' => 1486045020
)
);
```
I know I could use php's `date()` function to format it to a year, month and day, but ... | I found the solution - I used PHP's `date()` function to format it into a ISO 8601 compliant format, so there is no confusion around timezones, etc.
```
$args = array(
'date_query' => array(
'before' => date( 'c' , 1486045020 )
)
);
``` |
255,311 | <p>The all view shows all posts including drafts in <code>wp-admin/edit.php</code>.
How can I exclude the posts with the draft status in the all view?</p>
| [
{
"answer_id": 255315,
"author": "Dave Romsey",
"author_id": 2807,
"author_profile": "https://wordpress.stackexchange.com/users/2807",
"pm_score": 2,
"selected": false,
"text": "<p>The code below will remove draft posts from the admin area under the <em>All</em> listing for the <code>pos... | 2017/02/05 | [
"https://wordpress.stackexchange.com/questions/255311",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/80611/"
] | The all view shows all posts including drafts in `wp-admin/edit.php`.
How can I exclude the posts with the draft status in the all view? | The `show_in_admin_all_list` parameter in the [`register_post_status()`](https://developer.wordpress.org/reference/functions/register_post_status/) function, determines if a given post status is included in the *All* post table view.
Probably the shortest version is:
```
add_action( 'init', function() use ( &$wp_post... |
255,314 | <p>Up to now, I have had no problems with the background-image thumbnails in my theme. However, now that I'm trying to use an SVG as the featured image, something is breaking. The problem seems to related to the width of the SVGs being returned as zero by <code>wp_get_attachment_image_src()</code>. So what I am I tryi... | [
{
"answer_id": 255534,
"author": "prosti",
"author_id": 88606,
"author_profile": "https://wordpress.stackexchange.com/users/88606",
"pm_score": 2,
"selected": false,
"text": "<p>It is hard to guess exactly what may be the problem for the WordPress enthusiast like me but since you pinged ... | 2017/02/05 | [
"https://wordpress.stackexchange.com/questions/255314",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/105196/"
] | Up to now, I have had no problems with the background-image thumbnails in my theme. However, now that I'm trying to use an SVG as the featured image, something is breaking. The problem seems to related to the width of the SVGs being returned as zero by `wp_get_attachment_image_src()`. So what I am I trying to do is fig... | I solved it!!! The filter in fix #3 (above) wasn't working because of the third condition of this `if` statement that triggers the dimension extraction and attachment:
`if (is_array($image) && preg_match('/\.svg$/i', $image[0]) && $image[1] == 1)`
`$image[1]` in the third condition is the reported width of the SVG fi... |
255,317 | <p>I've followed the accepted answer in <a href="https://wordpress.stackexchange.com/q/125784/94498">this</a> question to generate my thumbnails in a custom way. </p>
<p>I extended the image editor class as:</p>
<pre><code>class WP_Image_Editor_Custom extends WP_Image_Editor_GD {
public function generate_filename... | [
{
"answer_id": 255946,
"author": "user6552940",
"author_id": 110206,
"author_profile": "https://wordpress.stackexchange.com/users/110206",
"pm_score": 1,
"selected": false,
"text": "<blockquote>\n <p>2- to store the original images in uploads/ and the thumbnails in a folder named thumbs... | 2017/02/06 | [
"https://wordpress.stackexchange.com/questions/255317",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/94498/"
] | I've followed the accepted answer in [this](https://wordpress.stackexchange.com/q/125784/94498) question to generate my thumbnails in a custom way.
I extended the image editor class as:
```
class WP_Image_Editor_Custom extends WP_Image_Editor_GD {
public function generate_filename($prefix = NULL, $dest_path = NU... | It appears that the thumbnail URLs are generated relatively to the upload folder. So trying to store them outside the uploads folder is not going to be a good idea.
There are hacks to filter the output for functions such as `the_post_thumbnail_url()`, but considering side issues such as the thumbnails not being able t... |
255,333 | <p>I am facing one issue while i'm creating my website. I have a search bar on my website. I tried to type and search in chinese, but the search terms on page that i entered become question mark and symbol. The url also same. I'm wondering how can make it work. Only the search terms become this. Any solution?</p>
<p><... | [
{
"answer_id": 255946,
"author": "user6552940",
"author_id": 110206,
"author_profile": "https://wordpress.stackexchange.com/users/110206",
"pm_score": 1,
"selected": false,
"text": "<blockquote>\n <p>2- to store the original images in uploads/ and the thumbnails in a folder named thumbs... | 2017/02/06 | [
"https://wordpress.stackexchange.com/questions/255333",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/23036/"
] | I am facing one issue while i'm creating my website. I have a search bar on my website. I tried to type and search in chinese, but the search terms on page that i entered become question mark and symbol. The url also same. I'm wondering how can make it work. Only the search terms become this. Any solution?
**Updated:*... | It appears that the thumbnail URLs are generated relatively to the upload folder. So trying to store them outside the uploads folder is not going to be a good idea.
There are hacks to filter the output for functions such as `the_post_thumbnail_url()`, but considering side issues such as the thumbnails not being able t... |
255,335 | <p>I am trying to add a photo slider from Slick and I can't seem to get it to work. </p>
<p>HTML</p>
<pre><code><div class="victoria-slider">
<div>Content1</div>
<div>Content2</div>
<div>Content3</div>
</div>
</code></pre>
<p>functions.php</p>
... | [
{
"answer_id": 255946,
"author": "user6552940",
"author_id": 110206,
"author_profile": "https://wordpress.stackexchange.com/users/110206",
"pm_score": 1,
"selected": false,
"text": "<blockquote>\n <p>2- to store the original images in uploads/ and the thumbnails in a folder named thumbs... | 2017/02/06 | [
"https://wordpress.stackexchange.com/questions/255335",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/101377/"
] | I am trying to add a photo slider from Slick and I can't seem to get it to work.
HTML
```
<div class="victoria-slider">
<div>Content1</div>
<div>Content2</div>
<div>Content3</div>
</div>
```
functions.php
```
function victoria_theme_script_enqueue() {
wp_enqueue_style('customstyle', ... | It appears that the thumbnail URLs are generated relatively to the upload folder. So trying to store them outside the uploads folder is not going to be a good idea.
There are hacks to filter the output for functions such as `the_post_thumbnail_url()`, but considering side issues such as the thumbnails not being able t... |
255,352 | <p>I'm trying to create a new database table when my plugin is activated using dbDelta() however, no new table seems to be creating. Since I'm new to WordPress development, please let me know where I'm going wrong.</p>
<pre><code><?php
/*
Plugin Name: Xenon-Result
Plugin URI: https://developer.wordpress.org/plugin... | [
{
"answer_id": 255946,
"author": "user6552940",
"author_id": 110206,
"author_profile": "https://wordpress.stackexchange.com/users/110206",
"pm_score": 1,
"selected": false,
"text": "<blockquote>\n <p>2- to store the original images in uploads/ and the thumbnails in a folder named thumbs... | 2017/02/06 | [
"https://wordpress.stackexchange.com/questions/255352",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/112658/"
] | I'm trying to create a new database table when my plugin is activated using dbDelta() however, no new table seems to be creating. Since I'm new to WordPress development, please let me know where I'm going wrong.
```
<?php
/*
Plugin Name: Xenon-Result
Plugin URI: https://developer.wordpress.org/plugins/the-basics/
Des... | It appears that the thumbnail URLs are generated relatively to the upload folder. So trying to store them outside the uploads folder is not going to be a good idea.
There are hacks to filter the output for functions such as `the_post_thumbnail_url()`, but considering side issues such as the thumbnails not being able t... |
255,372 | <p>I'm trying to make a conditional if the current author has uploaded a featured image in a custom post, but it ain't workin' ...</p>
<pre><code><?php if (
1 == count_user_posts( get_current_user_id(), "CUSTPOSTTYPE" )
&& is_user_logged_in()
&& has_post_thumbnail()
) { ?>
</code></pre>
| [
{
"answer_id": 255946,
"author": "user6552940",
"author_id": 110206,
"author_profile": "https://wordpress.stackexchange.com/users/110206",
"pm_score": 1,
"selected": false,
"text": "<blockquote>\n <p>2- to store the original images in uploads/ and the thumbnails in a folder named thumbs... | 2017/02/06 | [
"https://wordpress.stackexchange.com/questions/255372",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/37346/"
] | I'm trying to make a conditional if the current author has uploaded a featured image in a custom post, but it ain't workin' ...
```
<?php if (
1 == count_user_posts( get_current_user_id(), "CUSTPOSTTYPE" )
&& is_user_logged_in()
&& has_post_thumbnail()
) { ?>
``` | It appears that the thumbnail URLs are generated relatively to the upload folder. So trying to store them outside the uploads folder is not going to be a good idea.
There are hacks to filter the output for functions such as `the_post_thumbnail_url()`, but considering side issues such as the thumbnails not being able t... |
255,373 | <p>I would like to show certain Wordpress Post to one in 10 people. I am guessing it would be a JS solution which simply hides to post using a random number generator.</p>
<p>Has anyone ever face a similar scenario and care to show how they solved it?</p>
| [
{
"answer_id": 255388,
"author": "Johansson",
"author_id": 94498,
"author_profile": "https://wordpress.stackexchange.com/users/94498",
"pm_score": 1,
"selected": false,
"text": "<p>Assuming that you already have specific post IDs that you want to show randomly (1 per 10), you can use:</p... | 2017/02/06 | [
"https://wordpress.stackexchange.com/questions/255373",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/71177/"
] | I would like to show certain Wordpress Post to one in 10 people. I am guessing it would be a JS solution which simply hides to post using a random number generator.
Has anyone ever face a similar scenario and care to show how they solved it? | ```
function lsmwp_post_limter($ids, $in, $count) {
$i = rand(1,$count);
if ($i <= $in) {
return($ids);
}
else
return false;
}
function lsmWpfilter($posts){
$result = [];
foreach($posts as $post){
... |
255,375 | <p>Is it possible to add a number to the body class according to how many custom posts a current user has published, e.g. CUSTOMPOST-4</p>
| [
{
"answer_id": 255378,
"author": "Aniruddha Gawade",
"author_id": 101818,
"author_profile": "https://wordpress.stackexchange.com/users/101818",
"pm_score": 2,
"selected": false,
"text": "<p>You can use <code>count_user_posts</code></p>\n\n<p>See:</p>\n\n<p><a href=\"https://developer.wor... | 2017/02/06 | [
"https://wordpress.stackexchange.com/questions/255375",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/37346/"
] | Is it possible to add a number to the body class according to how many custom posts a current user has published, e.g. CUSTOMPOST-4 | add to functions.php
```
function wpc_body_class_section($classes) {
if (is_user_logged_in()) {
$classes[] = 'CUSTOMPOST-'.count_user_posts(get_current_user_id());
}
return $classes;
}
add_filter('body_class','wpc_body_class_section');
``` |
255,405 | <p>I am trying to inject a inline style css to my body element via the functions.php file.
It needs to be inline, because I am using a ACF to let the user change the image.</p>
<p>This should be the result:</p>
<pre><code><body style="background-image: url('<?php the_field('background'); ?>');">
</code></... | [
{
"answer_id": 255415,
"author": "Anwer AR",
"author_id": 83820,
"author_profile": "https://wordpress.stackexchange.com/users/83820",
"pm_score": 2,
"selected": false,
"text": "<p>Inline styles are styles that are written directly in the tag on the document & this is what you are loo... | 2017/02/06 | [
"https://wordpress.stackexchange.com/questions/255405",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/94376/"
] | I am trying to inject a inline style css to my body element via the functions.php file.
It needs to be inline, because I am using a ACF to let the user change the image.
This should be the result:
```
<body style="background-image: url('<?php the_field('background'); ?>');">
```
I read about the [wp add inline styl... | The easiest way I've seen is to `echo` it where you need it:
```php
function inline_css() {
echo "<style>html{background-color:#001337}</style>";
}
add_action( 'wp_head', 'inline_css', 0 );
```
Since 2019 you can also add styles inline inside the `body`, shown here without using `echo`:
```
function example_body_... |
255,406 | <p>I registered a new post type called "events". The posts of this type do show up in the loop but i can't access the single-events.php when i click on a "event" post. Also I can't access the categories of this post type. </p>
<p>The only advice you read on the internet - to flush the rewrite rules - didn't work me. ... | [
{
"answer_id": 255409,
"author": "Pat J",
"author_id": 16121,
"author_profile": "https://wordpress.stackexchange.com/users/16121",
"pm_score": 1,
"selected": false,
"text": "<p>You've registered the post type <code>event</code>, not <code>events</code>. So you should be able to use <code... | 2017/02/06 | [
"https://wordpress.stackexchange.com/questions/255406",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/80177/"
] | I registered a new post type called "events". The posts of this type do show up in the loop but i can't access the single-events.php when i click on a "event" post. Also I can't access the categories of this post type.
The only advice you read on the internet - to flush the rewrite rules - didn't work me.
Any other... | Hmm. After spending hours on research and trying out some suggested solutions I found out I just needed to add this arguments to the arguments array and only then to flush the permalinks (= switching to the default permalink structure and back to custom post name structure in the dashboard settings):
```
'public' => t... |
255,438 | <p>I have some code that is <strong>blocking the price from being shown on all products, if the user is not logged in</strong>.. this is what I want.</p>
<p>My issue is that I have <strong>1 product that is free, and I need the price to show if the user is not logged in</strong>. only on this single product...</p>
<p... | [
{
"answer_id": 255441,
"author": "fakemeta",
"author_id": 94429,
"author_profile": "https://wordpress.stackexchange.com/users/94429",
"pm_score": 1,
"selected": false,
"text": "<p>If you know the id, you can simply check current product id in your <code>woocommerce_get_price_html</code> ... | 2017/02/06 | [
"https://wordpress.stackexchange.com/questions/255438",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/96845/"
] | I have some code that is **blocking the price from being shown on all products, if the user is not logged in**.. this is what I want.
My issue is that I have **1 product that is free, and I need the price to show if the user is not logged in**. only on this single product...
Can someone help me target that single pro... | If you know the id, you can simply check current product id in your `woocommerce_get_price_html` action:
```
add_action('after_setup_theme','activate_filter') ;
function activate_filter() {
add_filter('woocommerce_get_price_html', 'show_price_logged');
}
function show_price_logged($price) {
global $product; ... |
255,450 | <p>Cron-jobs are incredibly slow in my website.</p>
<p>I created this small script, outside of the Wordpress environment, just to test the response time of WP Cron:</p>
<pre><code><?php
//Method which does a basic curl get request
function get_data($url) {
$ch = curl_init();
$timeout = 5;
cu... | [
{
"answer_id": 255466,
"author": "Lucas Bustamante",
"author_id": 27278,
"author_profile": "https://wordpress.stackexchange.com/users/27278",
"pm_score": 0,
"selected": false,
"text": "<p>Well, I did it with manual crons.</p>\n\n<p>I use NGINX + PHP-FPM, which makes it harder to do manua... | 2017/02/06 | [
"https://wordpress.stackexchange.com/questions/255450",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/27278/"
] | Cron-jobs are incredibly slow in my website.
I created this small script, outside of the Wordpress environment, just to test the response time of WP Cron:
```
<?php
//Method which does a basic curl get request
function get_data($url) {
$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT... | You can use [wp-cli](https://wp-cli.org/) to execute schedules without the detour via http request. Add in `crontab -e`.
```
*/30 * * * * wp cron event run --path=/path/to/wp-docroot
```
By this you wont run into maximum execution time problems which could be the reason why you schedule execution got stuck. |
255,462 | <p>I’ve been writing some class and functions to modify the path of thumbnails. I extended the original <code>WP_Image_Editor</code> class to achieve custom structure.</p>
<p><strong>What i want:</strong> to store the thumbnails in different folders based on their slugs, in the upload directory. such as : <code>http:/... | [
{
"answer_id": 255941,
"author": "user6552940",
"author_id": 110206,
"author_profile": "https://wordpress.stackexchange.com/users/110206",
"pm_score": 1,
"selected": false,
"text": "<p>A code sample explaining its use case will be more helpful.\nNot sure how you're going to use it, but t... | 2017/02/07 | [
"https://wordpress.stackexchange.com/questions/255462",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/94498/"
] | I’ve been writing some class and functions to modify the path of thumbnails. I extended the original `WP_Image_Editor` class to achieve custom structure.
**What i want:** to store the thumbnails in different folders based on their slugs, in the upload directory. such as : `http://example.com/uploads/medium/image.jpg`
... | Try adding this to functions.php:
```
add_filter("wp_image_editors", "my_wp_image_editors");
function my_wp_image_editors($editors) {
array_unshift($editors, "WP_Image_Editor_Custom");
return $editors;
}
// Include the existing classes first in order to extend them.
require_once ABSPATH . WPINC . "/class-wp-... |
255,468 | <p>I just realized that crawlers like google are triggering massive activity from all add_action binded to 'init'.</p>
<p>Is this normal behaviour? Is it possible to trigger 'init' only for legit visitors?</p>
| [
{
"answer_id": 255469,
"author": "Johansson",
"author_id": 94498,
"author_profile": "https://wordpress.stackexchange.com/users/94498",
"pm_score": 0,
"selected": false,
"text": "<p>Short answer to both your questions is : Yes.</p>\n\n<ul>\n<li>A google crawler bot is supposed to crawl ev... | 2017/02/07 | [
"https://wordpress.stackexchange.com/questions/255468",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/27278/"
] | I just realized that crawlers like google are triggering massive activity from all add\_action binded to 'init'.
Is this normal behaviour? Is it possible to trigger 'init' only for legit visitors? | Just added this to functions.php:
```
// Returns TRUE if it's a crawler
function check_is_crawler() {
if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/bot|wget|crawl|google|slurp|spider/i', $_SERVER['HTTP_USER_AGENT'])) {
return true;
} else {
return false;
}
}
```
And I'm using it ... |
255,478 | <p>I would like to include some css to highlight some text in post</p>
<p>like</p>
<pre><code> <span class="highlight">mark word</span>
</code></pre>
<p>where should i define highlight so that i can use it.</p>
| [
{
"answer_id": 255479,
"author": "Marc-Antoine Parent",
"author_id": 110578,
"author_profile": "https://wordpress.stackexchange.com/users/110578",
"pm_score": 1,
"selected": false,
"text": "<p>The easiest way in most recent themes is to use the Custom CSS from the Theme Customizer. If it... | 2017/02/07 | [
"https://wordpress.stackexchange.com/questions/255478",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/68286/"
] | I would like to include some css to highlight some text in post
like
```
<span class="highlight">mark word</span>
```
where should i define highlight so that i can use it. | The easiest way in most recent themes is to use the Custom CSS from the Theme Customizer. If it is enabled in your theme, you can access it through: `Appearance -> Customize`.
If it's not enabled, you should first refer to your theme's documentation. Is it a free or bought theme? |
255,502 | <p>I'm having a hard time trying to override my parent theme's <code>footer.php</code>, <code>footer-set.php</code> and <code>footer-tag.php</code> from my child theme.</p>
<p>I have just tried to copy-paste and modify them. No success. Maybe they are being read but probably later on, the ones from the parent prevail.... | [
{
"answer_id": 255519,
"author": "Tom Withers",
"author_id": 85362,
"author_profile": "https://wordpress.stackexchange.com/users/85362",
"pm_score": 0,
"selected": false,
"text": "<p>Quickly looking over this as work...</p>\n\n<p>But add:</p>\n\n<pre><code><?php get_footer(); ?>\n<... | 2017/02/07 | [
"https://wordpress.stackexchange.com/questions/255502",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/112732/"
] | I'm having a hard time trying to override my parent theme's `footer.php`, `footer-set.php` and `footer-tag.php` from my child theme.
I have just tried to copy-paste and modify them. No success. Maybe they are being read but probably later on, the ones from the parent prevail.
I have also tried to request them from th... | My friend, just take a look at their codex here <https://codex.wordpress.org/Function_Reference/get_footer> and you will know how. In your case, no need to add these
```
require_once get_stylesheet_directory() . '/footer.php';
require_once get_stylesheet_directory() . '/footer-set.php';
require_once get_stylesheet_dir... |
255,578 | <p>On my blog, for some reason, one of the category pages refuses to load new posts even when I clear all my caches. I'm using <code>WP Super Cache</code> (W3 Total Cache broke my site), <code>Autoptimize</code> and <code>Cloudflare</code> for caching.</p>
<p>I doubt the code is the problem since the other category pa... | [
{
"answer_id": 255567,
"author": "Chapman Atwell",
"author_id": 101432,
"author_profile": "https://wordpress.stackexchange.com/users/101432",
"pm_score": 1,
"selected": false,
"text": "<p>One quick fix seems to be to simply hardcode the URL in the <code>wp-config.php</code> file. Followi... | 2017/02/07 | [
"https://wordpress.stackexchange.com/questions/255578",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/104460/"
] | On my blog, for some reason, one of the category pages refuses to load new posts even when I clear all my caches. I'm using `WP Super Cache` (W3 Total Cache broke my site), `Autoptimize` and `Cloudflare` for caching.
I doubt the code is the problem since the other category pages are working just fine.
```
$query= new... | I normally just map my hosts file to the correct IP. This would work if you were only wanting to work on a site from your box only.
Only benefit to this option, as opposed to others, is that you wouldn't need to change any of your Wordpress settings to go live. |
255,594 | <p>I took over an existing multisite network and I don't have the privileges to promote anyone to network admin through the WP Admin UI directly. How can I promote my site administrator to network admin via MySQL and/or WP CLI?</p>
| [
{
"answer_id": 255596,
"author": "Vinnie James",
"author_id": 34762,
"author_profile": "https://wordpress.stackexchange.com/users/34762",
"pm_score": 2,
"selected": false,
"text": "<p>You might use grant_super_admin() </p>\n\n<p>To add an admin by user ID you can use grant_super_admin. S... | 2017/02/07 | [
"https://wordpress.stackexchange.com/questions/255594",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/83423/"
] | I took over an existing multisite network and I don't have the privileges to promote anyone to network admin through the WP Admin UI directly. How can I promote my site administrator to network admin via MySQL and/or WP CLI? | You might use grant\_super\_admin()
To add an admin by user ID you can use grant\_super\_admin. Simple put grant\_super\_admin in your theme’s functions.php file (usually in /wp-content/themes/CURRENT THEME NAME/functions.php). You’ll need to put the ID of the user as a variable, the example below we’re using the use... |
255,625 | <p>I'm creating a website that has search feature. I am wondering what should i do in order to make the search box works like <code>search everything</code>. The search term that visitor inserted may be hitting the tag name of the post, category of the post, content inside post or title of the post. As long as there is... | [
{
"answer_id": 255596,
"author": "Vinnie James",
"author_id": 34762,
"author_profile": "https://wordpress.stackexchange.com/users/34762",
"pm_score": 2,
"selected": false,
"text": "<p>You might use grant_super_admin() </p>\n\n<p>To add an admin by user ID you can use grant_super_admin. S... | 2017/02/08 | [
"https://wordpress.stackexchange.com/questions/255625",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/23036/"
] | I'm creating a website that has search feature. I am wondering what should i do in order to make the search box works like `search everything`. The search term that visitor inserted may be hitting the tag name of the post, category of the post, content inside post or title of the post. As long as there is a word within... | You might use grant\_super\_admin()
To add an admin by user ID you can use grant\_super\_admin. Simple put grant\_super\_admin in your theme’s functions.php file (usually in /wp-content/themes/CURRENT THEME NAME/functions.php). You’ll need to put the ID of the user as a variable, the example below we’re using the use... |
255,635 | <p>I have a custom page template named "page-news.php" and it contains</p>
<pre><code><?php
/*
* Template Name: News
*/
get_header();
?>
test
<?php
wp_footer();
get_footer();
?>
</code></pre>
<p>and I then create a page and set the template to "News" but when I view the page, it does not display the con... | [
{
"answer_id": 255596,
"author": "Vinnie James",
"author_id": 34762,
"author_profile": "https://wordpress.stackexchange.com/users/34762",
"pm_score": 2,
"selected": false,
"text": "<p>You might use grant_super_admin() </p>\n\n<p>To add an admin by user ID you can use grant_super_admin. S... | 2017/02/08 | [
"https://wordpress.stackexchange.com/questions/255635",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/24673/"
] | I have a custom page template named "page-news.php" and it contains
```
<?php
/*
* Template Name: News
*/
get_header();
?>
test
<?php
wp_footer();
get_footer();
?>
```
and I then create a page and set the template to "News" but when I view the page, it does not display the contents on the page-news.php custom page... | You might use grant\_super\_admin()
To add an admin by user ID you can use grant\_super\_admin. Simple put grant\_super\_admin in your theme’s functions.php file (usually in /wp-content/themes/CURRENT THEME NAME/functions.php). You’ll need to put the ID of the user as a variable, the example below we’re using the use... |
255,662 | <p>I have 404s generated for a deleted CSS&JS files and i want to redirect the requests for those files in general. I mean a redirect for all 404 generated for CSS&JS files. </p>
<p>These errors are generated by google crawlers.
Please note that those files are generated randomly from a caching plugin <code>WP... | [
{
"answer_id": 255596,
"author": "Vinnie James",
"author_id": 34762,
"author_profile": "https://wordpress.stackexchange.com/users/34762",
"pm_score": 2,
"selected": false,
"text": "<p>You might use grant_super_admin() </p>\n\n<p>To add an admin by user ID you can use grant_super_admin. S... | 2017/02/08 | [
"https://wordpress.stackexchange.com/questions/255662",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/102224/"
] | I have 404s generated for a deleted CSS&JS files and i want to redirect the requests for those files in general. I mean a redirect for all 404 generated for CSS&JS files.
These errors are generated by google crawlers.
Please note that those files are generated randomly from a caching plugin `WP Fastest Cache` which g... | You might use grant\_super\_admin()
To add an admin by user ID you can use grant\_super\_admin. Simple put grant\_super\_admin in your theme’s functions.php file (usually in /wp-content/themes/CURRENT THEME NAME/functions.php). You’ll need to put the ID of the user as a variable, the example below we’re using the use... |
255,665 | <p>I've recently started <a href="http://underscores.me/" rel="nofollow noreferrer">underscores</a> to make custom one off themes for clients because I like starting with a blank canvas. I see that lots of websites use custom themes which are generally named after the business they are made for, however I am concerned ... | [
{
"answer_id": 255596,
"author": "Vinnie James",
"author_id": 34762,
"author_profile": "https://wordpress.stackexchange.com/users/34762",
"pm_score": 2,
"selected": false,
"text": "<p>You might use grant_super_admin() </p>\n\n<p>To add an admin by user ID you can use grant_super_admin. S... | 2017/02/08 | [
"https://wordpress.stackexchange.com/questions/255665",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/112328/"
] | I've recently started [underscores](http://underscores.me/) to make custom one off themes for clients because I like starting with a blank canvas. I see that lots of websites use custom themes which are generally named after the business they are made for, however I am concerned that using underscores as a one person t... | You might use grant\_super\_admin()
To add an admin by user ID you can use grant\_super\_admin. Simple put grant\_super\_admin in your theme’s functions.php file (usually in /wp-content/themes/CURRENT THEME NAME/functions.php). You’ll need to put the ID of the user as a variable, the example below we’re using the use... |
255,691 | <p>For a client I need to group results on the search results page by category. In this case it would <em>not</em> be posts, but <strong>pages</strong> that have inherited categories form posts with the <a href="https://nl.wordpress.org/plugins/add-tags-and-category-to-page/" rel="nofollow noreferrer">Add Tags And Cate... | [
{
"answer_id": 255694,
"author": "Industrial Themes",
"author_id": 274,
"author_profile": "https://wordpress.stackexchange.com/users/274",
"pm_score": 1,
"selected": false,
"text": "<p>Add in the <a href=\"https://codex.wordpress.org/Class_Reference/WP_Query#Search_Parameter\" rel=\"nofo... | 2017/02/08 | [
"https://wordpress.stackexchange.com/questions/255691",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/75046/"
] | For a client I need to group results on the search results page by category. In this case it would *not* be posts, but **pages** that have inherited categories form posts with the [Add Tags And Category To Page And Post Types](https://nl.wordpress.org/plugins/add-tags-and-category-to-page/) plugin.
This is the non-edi... | Add in the [search parameter](https://codex.wordpress.org/Class_Reference/WP_Query#Search_Parameter) to your query:
```
$search_filters = array(
'post_type' => 'page', // Doorzoekt alle post types
's' => $keyword // show only posts that meet the current search query
);
```
And above that you should just be abl... |
255,722 | <p>I have recently been notified by Google Webmaster tools that there has been an increase in soft 404 pages. This is due to no results being returned by pre-defined links to search queries that are intended to filter through custom post types that have predefined tags.</p>
<p>What would be the best way to prevent a '... | [
{
"answer_id": 255694,
"author": "Industrial Themes",
"author_id": 274,
"author_profile": "https://wordpress.stackexchange.com/users/274",
"pm_score": 1,
"selected": false,
"text": "<p>Add in the <a href=\"https://codex.wordpress.org/Class_Reference/WP_Query#Search_Parameter\" rel=\"nofo... | 2017/02/08 | [
"https://wordpress.stackexchange.com/questions/255722",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/112876/"
] | I have recently been notified by Google Webmaster tools that there has been an increase in soft 404 pages. This is due to no results being returned by pre-defined links to search queries that are intended to filter through custom post types that have predefined tags.
What would be the best way to prevent a 'soft 404',... | Add in the [search parameter](https://codex.wordpress.org/Class_Reference/WP_Query#Search_Parameter) to your query:
```
$search_filters = array(
'post_type' => 'page', // Doorzoekt alle post types
's' => $keyword // show only posts that meet the current search query
);
```
And above that you should just be abl... |
255,738 | <p>I'm trying to change the layout of the <strong>post-new.php</strong> page and as part of this I would like the publish, save draft and preview buttons below the form rather than to the right.</p>
<p>So in my plugin js file I'm using jQuery.append() to move them into a custom that sits below the main . I'm moving t... | [
{
"answer_id": 255694,
"author": "Industrial Themes",
"author_id": 274,
"author_profile": "https://wordpress.stackexchange.com/users/274",
"pm_score": 1,
"selected": false,
"text": "<p>Add in the <a href=\"https://codex.wordpress.org/Class_Reference/WP_Query#Search_Parameter\" rel=\"nofo... | 2017/02/09 | [
"https://wordpress.stackexchange.com/questions/255738",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/112889/"
] | I'm trying to change the layout of the **post-new.php** page and as part of this I would like the publish, save draft and preview buttons below the form rather than to the right.
So in my plugin js file I'm using jQuery.append() to move them into a custom that sits below the main . I'm moving the divs: #save-action, #... | Add in the [search parameter](https://codex.wordpress.org/Class_Reference/WP_Query#Search_Parameter) to your query:
```
$search_filters = array(
'post_type' => 'page', // Doorzoekt alle post types
's' => $keyword // show only posts that meet the current search query
);
```
And above that you should just be abl... |
255,749 | <p>I need help. I’m making a plugin in woo which add html when URL contains a specific word.</p>
<p>I used <code>get_site_url</code>, <code>get_permalink</code>, and others but strangely none was sending the information. Finally I decided use <code>$_SERVER[REQUEST_URI]</code> and works but on some pages doesn’t. Why ... | [
{
"answer_id": 255751,
"author": "Roel Magdaleno",
"author_id": 99204,
"author_profile": "https://wordpress.stackexchange.com/users/99204",
"pm_score": 1,
"selected": false,
"text": "<p>how's the URL structure? Could you paste here?</p>\n\n<p>If you're URL follows this structure: <code>h... | 2017/02/09 | [
"https://wordpress.stackexchange.com/questions/255749",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/112896/"
] | I need help. I’m making a plugin in woo which add html when URL contains a specific word.
I used `get_site_url`, `get_permalink`, and others but strangely none was sending the information. Finally I decided use `$_SERVER[REQUEST_URI]` and works but on some pages doesn’t. Why is this happening? What can I do? | how's the URL structure? Could you paste here?
If you're URL follows this structure: `http://example.com/?foo=bar`, so you need to get the `foo` value with this:
```
if ( isset( $_GET['foo'] ) ) {
$bar_value = $_GET['foo'];
// Do whatever you want with $bar_value.
} else {
// Do something else.
}
```
If tha... |
255,750 | <p><strong>UPDATE:</strong> I have corrected the below code, to reflect the answer which resolved my issue.</p>
<p>I have created a Custom Admin Page and have managed to get all of my Fields and Save buttons to work.</p>
<p>Within said Custom Admin Page, I have an 'Upload Profile Image' button. The button works fin... | [
{
"answer_id": 255753,
"author": "Craig",
"author_id": 112472,
"author_profile": "https://wordpress.stackexchange.com/users/112472",
"pm_score": 2,
"selected": true,
"text": "<p>I have just sussed out the answer. I was missing the <code>mediaUploader.open();</code> entry. I have amende... | 2017/02/09 | [
"https://wordpress.stackexchange.com/questions/255750",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/112472/"
] | **UPDATE:** I have corrected the below code, to reflect the answer which resolved my issue.
I have created a Custom Admin Page and have managed to get all of my Fields and Save buttons to work.
Within said Custom Admin Page, I have an 'Upload Profile Image' button. The button works fine, in the respect of triggering ... | I have just sussed out the answer. I was missing the `mediaUploader.open();` entry. I have amended my original code, accordingly, just in case anyone is having the same issue. |
255,760 | <p>I have a WP Network (sub directory), Sometime specially in case of security emergencies, it is generally preferred to change passwords for all users. </p>
<p>I am looking for a way to reset passwords by sending a password reset url
via email to each user on the network.</p>
<p>Goal here is to just reset all passw... | [
{
"answer_id": 356337,
"author": "Rafa",
"author_id": 181040,
"author_profile": "https://wordpress.stackexchange.com/users/181040",
"pm_score": 0,
"selected": false,
"text": "<p><code>user reset-password user1 user2 userN</code></p>\n\n<p>Will reset password and send email notification t... | 2017/02/09 | [
"https://wordpress.stackexchange.com/questions/255760",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/73820/"
] | I have a WP Network (sub directory), Sometime specially in case of security emergencies, it is generally preferred to change passwords for all users.
I am looking for a way to reset passwords by sending a password reset url
via email to each user on the network.
Goal here is to just reset all passwords and make use... | A simple solution is:
```
wp user reset-password $(wp user list --field=user_login)
```
got that from forcing all plugins update after a minor takeover:
```
wp plugin install $(wp plugin list --field=name) --force
``` |
255,767 | <p>I created this plugin and now I'm getting fatal error message. I'm very new to this. Please tell me where I'm wrong:</p>
<pre><code><?php
/*
Plugin Name: Xenon-Result
Plugin URI: https://developer.wordpress.org/plugins/the-basics/
Description: Basic result display plugin.
Version: 1.0
Author: Himanshu ... | [
{
"answer_id": 255796,
"author": "woony",
"author_id": 17541,
"author_profile": "https://wordpress.stackexchange.com/users/17541",
"pm_score": 0,
"selected": false,
"text": "<p>Most likely you made a change to your theme and made an error. Which does not allow to parse the code correctly... | 2017/02/09 | [
"https://wordpress.stackexchange.com/questions/255767",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/112658/"
] | I created this plugin and now I'm getting fatal error message. I'm very new to this. Please tell me where I'm wrong:
```
<?php
/*
Plugin Name: Xenon-Result
Plugin URI: https://developer.wordpress.org/plugins/the-basics/
Description: Basic result display plugin.
Version: 1.0
Author: Himanshu Gupta
Author URI:... | Sounds like a theme or a plugin is causing the problem. Try renaming the wp-content/plugins folder to quickly disable all plugins and then try logging in. Add the plugins back into the wp-content/plugins folder to find the culprit.
If you have access to the error log file (assuming the site is not that busy), then you... |
255,771 | <p>I have problem with custom post type - permalink is doesn't show:</p>
<p><a href="https://i.stack.imgur.com/MfTql.png" rel="noreferrer"><img src="https://i.stack.imgur.com/MfTql.png" alt="enter image description here"></a></p>
<p>Post type is published, but I can't it show on website.
I tried change permalink stru... | [
{
"answer_id": 255795,
"author": "Svartbaard",
"author_id": 112928,
"author_profile": "https://wordpress.stackexchange.com/users/112928",
"pm_score": 0,
"selected": false,
"text": "<p>Try removing <em>exclude from search</em> and set your permalinks to <strong>Post name</strong>.</p>\n\n... | 2017/02/09 | [
"https://wordpress.stackexchange.com/questions/255771",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/59666/"
] | I have problem with custom post type - permalink is doesn't show:
[](https://i.stack.imgur.com/MfTql.png)
Post type is published, but I can't it show on website.
I tried change permalink structure to `?p=123`, but it still doesn't work. I tried chang... | I set the following to true to display the permalinks in the admin section.
```
'publicly_queryable' => true,
``` |
255,775 | <p>I have finally managed to get my plugin working. However, upon submission the whole page reloads along with my output above the form. How can I avoid my page to completely reload and not to display the form once it is submitted?</p>
<pre><code><?php
function installer(){
include('installer.php');
}
regi... | [
{
"answer_id": 255795,
"author": "Svartbaard",
"author_id": 112928,
"author_profile": "https://wordpress.stackexchange.com/users/112928",
"pm_score": 0,
"selected": false,
"text": "<p>Try removing <em>exclude from search</em> and set your permalinks to <strong>Post name</strong>.</p>\n\n... | 2017/02/09 | [
"https://wordpress.stackexchange.com/questions/255775",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/112658/"
] | I have finally managed to get my plugin working. However, upon submission the whole page reloads along with my output above the form. How can I avoid my page to completely reload and not to display the form once it is submitted?
```
<?php
function installer(){
include('installer.php');
}
register_activation_ho... | I set the following to true to display the permalinks in the admin section.
```
'publicly_queryable' => true,
``` |
255,777 | <p>I have a WordPress website, I submitted it to Google Webmaster and after submitting the sitemap, it's giving me error "URL blocked by robots.txt".</p>
<p>Please help, what should I do?</p>
| [
{
"answer_id": 255795,
"author": "Svartbaard",
"author_id": 112928,
"author_profile": "https://wordpress.stackexchange.com/users/112928",
"pm_score": 0,
"selected": false,
"text": "<p>Try removing <em>exclude from search</em> and set your permalinks to <strong>Post name</strong>.</p>\n\n... | 2017/02/09 | [
"https://wordpress.stackexchange.com/questions/255777",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/112920/"
] | I have a WordPress website, I submitted it to Google Webmaster and after submitting the sitemap, it's giving me error "URL blocked by robots.txt".
Please help, what should I do? | I set the following to true to display the permalinks in the admin section.
```
'publicly_queryable' => true,
``` |
255,782 | <p>I create some dynamic pages in Wordpress through PHP. Lots of them.</p>
<p>Those are not visible in Wordpress backend, as all the data is taken from different database. Each of them use signle PHP template, but have unique URL. Its working just fine.</p>
<p>I have also created taxonomy tags in Wordpress.</p>
<p>H... | [
{
"answer_id": 255795,
"author": "Svartbaard",
"author_id": 112928,
"author_profile": "https://wordpress.stackexchange.com/users/112928",
"pm_score": 0,
"selected": false,
"text": "<p>Try removing <em>exclude from search</em> and set your permalinks to <strong>Post name</strong>.</p>\n\n... | 2017/02/09 | [
"https://wordpress.stackexchange.com/questions/255782",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/112926/"
] | I create some dynamic pages in Wordpress through PHP. Lots of them.
Those are not visible in Wordpress backend, as all the data is taken from different database. Each of them use signle PHP template, but have unique URL. Its working just fine.
I have also created taxonomy tags in Wordpress.
How to tell Wordpress tha... | I set the following to true to display the permalinks in the admin section.
```
'publicly_queryable' => true,
``` |
255,804 | <p>I want to add page templates to a theme directly from the plugin. The idea is that the template would show up in the dropdown under Page Attributes, and all the code would need to be in the plugin.</p>
<p>Any tips on how to achieve that ?</p>
| [
{
"answer_id": 255809,
"author": "mrben522",
"author_id": 84703,
"author_profile": "https://wordpress.stackexchange.com/users/84703",
"pm_score": -1,
"selected": false,
"text": "<pre><code><?php load_template( $_template_file, $require_once ) ?>\n</code></pre>\n\n<p>That is from th... | 2017/02/09 | [
"https://wordpress.stackexchange.com/questions/255804",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/112935/"
] | I want to add page templates to a theme directly from the plugin. The idea is that the template would show up in the dropdown under Page Attributes, and all the code would need to be in the plugin.
Any tips on how to achieve that ? | You can use the [`theme_page_templates`](https://developer.wordpress.org/reference/hooks/theme_page_templates/) filter to add templates to the dropdown list of page templates like this:
```
function wpse255804_add_page_template ($templates) {
$templates['my-custom-template.php'] = 'My Template';
return $templa... |
255,813 | <p>Google Search Console detects Category Pagination data up Duplicate Meta Description. Duplicate meta descriptions data is the category description that I have provided, which shows up in every pages.</p>
<p>The error is of Duplicate meta descriptions under HTML Improvements.</p>
<p>The better way I can explain thi... | [
{
"answer_id": 255809,
"author": "mrben522",
"author_id": 84703,
"author_profile": "https://wordpress.stackexchange.com/users/84703",
"pm_score": -1,
"selected": false,
"text": "<pre><code><?php load_template( $_template_file, $require_once ) ?>\n</code></pre>\n\n<p>That is from th... | 2017/02/09 | [
"https://wordpress.stackexchange.com/questions/255813",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/107637/"
] | Google Search Console detects Category Pagination data up Duplicate Meta Description. Duplicate meta descriptions data is the category description that I have provided, which shows up in every pages.
The error is of Duplicate meta descriptions under HTML Improvements.
The better way I can explain this problem is by s... | You can use the [`theme_page_templates`](https://developer.wordpress.org/reference/hooks/theme_page_templates/) filter to add templates to the dropdown list of page templates like this:
```
function wpse255804_add_page_template ($templates) {
$templates['my-custom-template.php'] = 'My Template';
return $templa... |
255,850 | <p>I want to make all new commenters have a new account without them having to go through any registration process. That way if they use the same details again it will be stored as another comment they made.</p>
<p>I do not want to require them to "register" but instead register them automatically when they put their ... | [
{
"answer_id": 255854,
"author": "Johansson",
"author_id": 94498,
"author_profile": "https://wordpress.stackexchange.com/users/94498",
"pm_score": 0,
"selected": false,
"text": "<p>To achieve this, create a new page template and use this code in that file. Then, use your submit form to r... | 2017/02/09 | [
"https://wordpress.stackexchange.com/questions/255850",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/112958/"
] | I want to make all new commenters have a new account without them having to go through any registration process. That way if they use the same details again it will be stored as another comment they made.
I do not want to require them to "register" but instead register them automatically when they put their info into ... | To achieve this, create a new page template and use this code in that file. Then, use your submit form to redirect the user after commenting to the new page.
```
$user_login = $_POST['user_login'];
$user_email = $_POST['user_email'];
$errors = register_new_user($user_login, $user_email);
if ( !is_wp_error($errors) ) {... |
255,880 | <p>I need to initialize some variables in various templates (index, single, page) such as banner image of that page. But then use that value in the 'get_header()' template. A good example of this is the og_image that's usually in the header.php set of meta tags inside the head of the HTML. This image is the visual moni... | [
{
"answer_id": 255854,
"author": "Johansson",
"author_id": 94498,
"author_profile": "https://wordpress.stackexchange.com/users/94498",
"pm_score": 0,
"selected": false,
"text": "<p>To achieve this, create a new page template and use this code in that file. Then, use your submit form to r... | 2017/02/09 | [
"https://wordpress.stackexchange.com/questions/255880",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/16142/"
] | I need to initialize some variables in various templates (index, single, page) such as banner image of that page. But then use that value in the 'get\_header()' template. A good example of this is the og\_image that's usually in the header.php set of meta tags inside the head of the HTML. This image is the visual monik... | To achieve this, create a new page template and use this code in that file. Then, use your submit form to redirect the user after commenting to the new page.
```
$user_login = $_POST['user_login'];
$user_email = $_POST['user_email'];
$errors = register_new_user($user_login, $user_email);
if ( !is_wp_error($errors) ) {... |
255,897 | <p>Following <a href="http://biostall.com/performing-a-radial-search-with-wp_query-in-wordpress/" rel="nofollow noreferrer">this tutorial</a>, I want to search for posts within the radius where the <code>post_type=profile</code></p>
<pre><code>add_filter('posts_where', 'location_posts_where', 10);
$query = new WP_Quer... | [
{
"answer_id": 255919,
"author": "Brian Fegter",
"author_id": 4793,
"author_profile": "https://wordpress.stackexchange.com/users/4793",
"pm_score": 1,
"selected": false,
"text": "<p>You are removing the filter too early. Remove it after you have completed your loop and everything should ... | 2017/02/10 | [
"https://wordpress.stackexchange.com/questions/255897",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/447/"
] | Following [this tutorial](http://biostall.com/performing-a-radial-search-with-wp_query-in-wordpress/), I want to search for posts within the radius where the `post_type=profile`
```
add_filter('posts_where', 'location_posts_where', 10);
$query = new WP_Query( array( 'post_type' => 'profile' ) );
remove_filter('posts... | Remove this part from your `posts_where` filter:
```
if (is_search() && get_search_query())
```
Note that `is_search()` is a check on the main query.
If you want to target the main search query, there's the `posts_search` filter available.
**Important**: Watch out for possible SQL injections, as you are taking use... |
255,900 | <p>i using this code:</p>
<pre><code><?php ob_start(); echo '<div class="judul"><h3 style="text-align: center;"><strong>Download <?php echo esc_html( $judul ); ?> Batch Kumpulan Subtitle Indonesia</strong></h3></div>';
echo '<p><div class="deps"><h4>';
ech... | [
{
"answer_id": 255901,
"author": "Milo",
"author_id": 4771,
"author_profile": "https://wordpress.stackexchange.com/users/4771",
"pm_score": 1,
"selected": false,
"text": "<p>You don't see anything because you're assigning the content to <code>$out</code> but then you don't do anything wi... | 2017/02/10 | [
"https://wordpress.stackexchange.com/questions/255900",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/112986/"
] | i using this code:
```
<?php ob_start(); echo '<div class="judul"><h3 style="text-align: center;"><strong>Download <?php echo esc_html( $judul ); ?> Batch Kumpulan Subtitle Indonesia</strong></h3></div>';
echo '<p><div class="deps"><h4>';
echo "<strong>Episode $bepisode</strong></h4>";
echo '</div></p>';
echo '<div cl... | You don't see anything because you're assigning the content to `$out` but then you don't do anything with that value. Shortcodes have to `return` their content or you won't see any output.
```
$out = ob_get_clean();
return $out;
```
or just
```
return ob_get_clean();
``` |
255,936 | <p>I'm trying to filter the contents of my page template dropdown in the admin area. Having done some Googling it seems that the hook I need to use is theme_page_templates ... but this just does not run for me. I have no idea why but the code is not called at all. This is the code I'm using, but nothing happens.</p>
<... | [
{
"answer_id": 255938,
"author": "Tunji",
"author_id": 54764,
"author_profile": "https://wordpress.stackexchange.com/users/54764",
"pm_score": 0,
"selected": false,
"text": "<p>You have a call to <code>die()</code> in your function, which terminates the execution of your function and out... | 2017/02/10 | [
"https://wordpress.stackexchange.com/questions/255936",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/62621/"
] | I'm trying to filter the contents of my page template dropdown in the admin area. Having done some Googling it seems that the hook I need to use is theme\_page\_templates ... but this just does not run for me. I have no idea why but the code is not called at all. This is the code I'm using, but nothing happens.
```
fu... | The `theme_page_templates` filter is not available anymore, please use the `theme_templates` filter instead.
```php
add_filter( 'theme_templates', 'filter_template_dropdown' );
``` |
255,977 | <p>I have created a real estate theme, and for each property there is a property listing expiry date after which the property no longer shows on the site. Each property is a custom Properties post type. The code I use to only use live properties is;</p>
<pre><code>function live_properties_only( $query ) {
if ( ! ... | [
{
"answer_id": 255979,
"author": "mr__culpepper",
"author_id": 108606,
"author_profile": "https://wordpress.stackexchange.com/users/108606",
"pm_score": 0,
"selected": false,
"text": "<p>It seems you are only querying only for posts of the type 'properties.' I'm not 100% sure, but removi... | 2017/02/10 | [
"https://wordpress.stackexchange.com/questions/255977",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/36773/"
] | I have created a real estate theme, and for each property there is a property listing expiry date after which the property no longer shows on the site. Each property is a custom Properties post type. The code I use to only use live properties is;
```
function live_properties_only( $query ) {
if ( ! is_main_query(... | I think you need to check if you are in the `properties` post type archive before to manipulate the query, so it doesn't affect to other archives.
Also, you need to check if the actual `$query` is the main query, so other queries are not affected (the function `is_main_query()` does a different thing; it doesn't check... |
255,990 | <p>I've successfully managed to add the class 'active' to the current page item using the for each in my template page. </p>
<p>What I want to do is with jQuery (or css3 if anyone has any ideas) get the ul of current li to display if either it is active or on clicking on another div.</p>
<p>Here is the output of my H... | [
{
"answer_id": 255979,
"author": "mr__culpepper",
"author_id": 108606,
"author_profile": "https://wordpress.stackexchange.com/users/108606",
"pm_score": 0,
"selected": false,
"text": "<p>It seems you are only querying only for posts of the type 'properties.' I'm not 100% sure, but removi... | 2017/02/10 | [
"https://wordpress.stackexchange.com/questions/255990",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/91951/"
] | I've successfully managed to add the class 'active' to the current page item using the for each in my template page.
What I want to do is with jQuery (or css3 if anyone has any ideas) get the ul of current li to display if either it is active or on clicking on another div.
Here is the output of my HTML
```
<div id... | I think you need to check if you are in the `properties` post type archive before to manipulate the query, so it doesn't affect to other archives.
Also, you need to check if the actual `$query` is the main query, so other queries are not affected (the function `is_main_query()` does a different thing; it doesn't check... |
255,996 | <p>I am using the Simplelightbox plugin (<a href="https://wordpress.org/plugins/simplelightbox/" rel="nofollow noreferrer">Plugin URL</a> or <a href="https://www.andrerinas.de/simplelightbox.html" rel="nofollow noreferrer">Homepage URL</a>) on my site: <a href="http://joshrodg.com/condos/pictures/" rel="nofollow norefe... | [
{
"answer_id": 256001,
"author": "rudtek",
"author_id": 77767,
"author_profile": "https://wordpress.stackexchange.com/users/77767",
"pm_score": -1,
"selected": false,
"text": "<p>I assume you mean to you want to stop the notifications?</p>\n\n<p>The simplest and easiest way is to change ... | 2017/02/10 | [
"https://wordpress.stackexchange.com/questions/255996",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/9820/"
] | I am using the Simplelightbox plugin ([Plugin URL](https://wordpress.org/plugins/simplelightbox/) or [Homepage URL](https://www.andrerinas.de/simplelightbox.html)) on my site: <http://joshrodg.com/condos/pictures/>
On that page I have a picture gallery that is using the Lightbox and then right below the picture galler... | Create a plugin that dequeues the javascript you don't want, and enqueues the edited javascript.
```
<?php
/**
* Plugin Name: Stackexchange Sample
* Author: Nathan Johnson
* Licence: GPL2+
* Licence URI: https://www.gnu.org/licenses/gpl-2.0.en.html
* Domain Path: /languages
* Text Domain: stackexchange-sample
*... |
256,009 | <p>I've noticed a random JavaScript function at the end of the source code of my WordPress website. </p>
<pre><code><script type="text/javascript">
(function() {
var request, b = document.body, c = 'className', cs = 'customize-support', rcs = new RegExp('(^|\\s+)(no-)?'+cs+'(\\s+|$)');
... | [
{
"answer_id": 256001,
"author": "rudtek",
"author_id": 77767,
"author_profile": "https://wordpress.stackexchange.com/users/77767",
"pm_score": -1,
"selected": false,
"text": "<p>I assume you mean to you want to stop the notifications?</p>\n\n<p>The simplest and easiest way is to change ... | 2017/02/10 | [
"https://wordpress.stackexchange.com/questions/256009",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/86794/"
] | I've noticed a random JavaScript function at the end of the source code of my WordPress website.
```
<script type="text/javascript">
(function() {
var request, b = document.body, c = 'className', cs = 'customize-support', rcs = new RegExp('(^|\\s+)(no-)?'+cs+'(\\s+|$)');
request = true;
... | Create a plugin that dequeues the javascript you don't want, and enqueues the edited javascript.
```
<?php
/**
* Plugin Name: Stackexchange Sample
* Author: Nathan Johnson
* Licence: GPL2+
* Licence URI: https://www.gnu.org/licenses/gpl-2.0.en.html
* Domain Path: /languages
* Text Domain: stackexchange-sample
*... |
256,010 | <p>I'm working on a Wordpress Multi-user site (Buddypress?). Every day, there are between 5-15 new accounts created, yet Google Analytics is reporting little-to-no traffic.</p>
<p>The site is far from finished, and I long ago disabled all content-creation features for non-administrators (because as soon as it went liv... | [
{
"answer_id": 256001,
"author": "rudtek",
"author_id": 77767,
"author_profile": "https://wordpress.stackexchange.com/users/77767",
"pm_score": -1,
"selected": false,
"text": "<p>I assume you mean to you want to stop the notifications?</p>\n\n<p>The simplest and easiest way is to change ... | 2017/02/10 | [
"https://wordpress.stackexchange.com/questions/256010",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/112562/"
] | I'm working on a Wordpress Multi-user site (Buddypress?). Every day, there are between 5-15 new accounts created, yet Google Analytics is reporting little-to-no traffic.
The site is far from finished, and I long ago disabled all content-creation features for non-administrators (because as soon as it went live people o... | Create a plugin that dequeues the javascript you don't want, and enqueues the edited javascript.
```
<?php
/**
* Plugin Name: Stackexchange Sample
* Author: Nathan Johnson
* Licence: GPL2+
* Licence URI: https://www.gnu.org/licenses/gpl-2.0.en.html
* Domain Path: /languages
* Text Domain: stackexchange-sample
*... |
256,011 | <p>Is there an effective method to find a place where wordpress's hook is declared and when it's activated?</p>
<p>For example:<br>
I know that <code>get_header</code> hook is declared inside <code>wp-includes\general-template.php -- function get_header(...)</code>. When this function is called, the hook is activated.... | [
{
"answer_id": 256017,
"author": "Viktor",
"author_id": 13351,
"author_profile": "https://wordpress.stackexchange.com/users/13351",
"pm_score": 0,
"selected": false,
"text": "<p>You can perform a search on <a href=\"https://developer.wordpress.org/reference\" rel=\"nofollow noreferrer\">... | 2017/02/10 | [
"https://wordpress.stackexchange.com/questions/256011",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/70809/"
] | Is there an effective method to find a place where wordpress's hook is declared and when it's activated?
For example:
I know that `get_header` hook is declared inside `wp-includes\general-template.php -- function get_header(...)`. When this function is called, the hook is activated.
In this case that was easy but ... | [Here in this page](http://adambrown.info/p/wp_hooks/hook) its the list of all action and filter hooks, just click on one and it will tell you in which file you can find it, a partial view of where is declared, and below are the related hooks.
you can see a list of hooks and the functions attached to it using:
```
$h... |
256,031 | <p>We have a Directory website <a href="http://prntscr.com/e76vrf" rel="nofollow noreferrer">http://prntscr.com/e76vrf</a> running at LISTABLE Theme. </p>
<ol>
<li><p>Currently, when a User Signs Up and Upload the "Profile Photo", "Cover Photos" there is no provision to adjust the Photo and the wider photos cut off af... | [
{
"answer_id": 256017,
"author": "Viktor",
"author_id": 13351,
"author_profile": "https://wordpress.stackexchange.com/users/13351",
"pm_score": 0,
"selected": false,
"text": "<p>You can perform a search on <a href=\"https://developer.wordpress.org/reference\" rel=\"nofollow noreferrer\">... | 2017/02/10 | [
"https://wordpress.stackexchange.com/questions/256031",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/101240/"
] | We have a Directory website <http://prntscr.com/e76vrf> running at LISTABLE Theme.
1. Currently, when a User Signs Up and Upload the "Profile Photo", "Cover Photos" there is no provision to adjust the Photo and the wider photos cut off after saving them. So we want to add an image resizer/cropper which can let users ... | [Here in this page](http://adambrown.info/p/wp_hooks/hook) its the list of all action and filter hooks, just click on one and it will tell you in which file you can find it, a partial view of where is declared, and below are the related hooks.
you can see a list of hooks and the functions attached to it using:
```
$h... |
256,039 | <p>So I have a localhost WordPress server, and the function wp_mail workd perfectly and sends. When I put the exact same file in an actual WordPress website as a theme, it only shows me a blank screen, and doesn't send anything. Code:</p>
<pre><code><?php
if (isset($_POST['submit'])) {
$first_name = $_POST['first_n... | [
{
"answer_id": 256017,
"author": "Viktor",
"author_id": 13351,
"author_profile": "https://wordpress.stackexchange.com/users/13351",
"pm_score": 0,
"selected": false,
"text": "<p>You can perform a search on <a href=\"https://developer.wordpress.org/reference\" rel=\"nofollow noreferrer\">... | 2017/02/11 | [
"https://wordpress.stackexchange.com/questions/256039",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/112811/"
] | So I have a localhost WordPress server, and the function wp\_mail workd perfectly and sends. When I put the exact same file in an actual WordPress website as a theme, it only shows me a blank screen, and doesn't send anything. Code:
```
<?php
if (isset($_POST['submit'])) {
$first_name = $_POST['first_name'];
$last_nam... | [Here in this page](http://adambrown.info/p/wp_hooks/hook) its the list of all action and filter hooks, just click on one and it will tell you in which file you can find it, a partial view of where is declared, and below are the related hooks.
you can see a list of hooks and the functions attached to it using:
```
$h... |
256,050 | <p>Today one of our clients' WordPress sites was hacked which is hosted with amazon aws ubuntu.</p>
<p>Issue is <a href="https://blog.sucuri.net/2016/01/jquery-pastebin-replacement.html" rel="nofollow noreferrer">https://blog.sucuri.net/2016/01/jquery-pastebin-replacement.html</a></p>
<p>The js code is injected in al... | [
{
"answer_id": 256073,
"author": "吉 宁",
"author_id": 105000,
"author_profile": "https://wordpress.stackexchange.com/users/105000",
"pm_score": 2,
"selected": false,
"text": "<p>The backdoor is most likely located in the theme's functions.php file.Look through it and you will find the ans... | 2017/02/11 | [
"https://wordpress.stackexchange.com/questions/256050",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/27932/"
] | Today one of our clients' WordPress sites was hacked which is hosted with amazon aws ubuntu.
Issue is <https://blog.sucuri.net/2016/01/jquery-pastebin-replacement.html>
The js code is injected in all js
```
var _0xaae8=["","\x6A\x6F\x69\x6E","\x72\x65\x76\x65\x72\x73\x65","\x73\x70\x6C\x69\x74","\x3E\x74\x70\x69\x72... | The backdoor is most likely located in the theme's functions.php file.Look through it and you will find the answer I believe.
WordPress core is so rarely compromised.This must be caused by a malicious theme. |
256,071 | <p>The answer to <a href="https://wordpress.stackexchange.com/questions/69506/hide-content-box-on-specific-pages-in-admin">this question</a> is working great but I want to exclude the editor also when other templates are used. Can you please tell me how to extend the code to make this work with more than one template?<... | [
{
"answer_id": 256075,
"author": "user6552940",
"author_id": 110206,
"author_profile": "https://wordpress.stackexchange.com/users/110206",
"pm_score": 4,
"selected": true,
"text": "<p>Yes, try this :</p>\n\n<pre><code>function remove_editor() {\n if (isset($_GET['post'])) {\n $... | 2017/02/11 | [
"https://wordpress.stackexchange.com/questions/256071",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/113083/"
] | The answer to [this question](https://wordpress.stackexchange.com/questions/69506/hide-content-box-on-specific-pages-in-admin) is working great but I want to exclude the editor also when other templates are used. Can you please tell me how to extend the code to make this work with more than one template? | Yes, try this :
```
function remove_editor() {
if (isset($_GET['post'])) {
$id = $_GET['post'];
$template = get_post_meta($id, '_wp_page_template', true);
switch ($template) {
case 'template_01.php':
case 'template_02.php':
case 'template_03.php':
... |
256,087 | <p>I recently added a caption to my image in WordPress and now there is an empty <code><p></p></code> tag after <code><img></code> tag. It broke my style.</p>
<p>Can anyone tell how to remove it?</p>
<p>Thanks for the help.</p>
<p><a href="https://i.stack.imgur.com/VYPiW.png" rel="nofollow noreferrer"... | [
{
"answer_id": 256097,
"author": "Fayaz",
"author_id": 110572,
"author_profile": "https://wordpress.stackexchange.com/users/110572",
"pm_score": 2,
"selected": false,
"text": "<h1>Removing <code>wpautop</code>:</h1>\n\n<p>This is most likely from <a href=\"https://developer.wordpress.org... | 2017/02/11 | [
"https://wordpress.stackexchange.com/questions/256087",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/113088/"
] | I recently added a caption to my image in WordPress and now there is an empty `<p></p>` tag after `<img>` tag. It broke my style.
Can anyone tell how to remove it?
Thanks for the help.
[](https://i.stack.imgur.com/VYPiW.png) | It is not a good practice to override the WordPress native functionality. Instead you can hide the empty elements using CSS
```
p:empty {
display: none;
}
```
This will the empty elements. |
256,117 | <p>I've created a simple plugin for our WP site to allow us to enter in our products that we despatch.</p>
<p>To do this I've created a new Post Type called 'order_packing' and within that 2 new Post Statuses: 'In Packing', 'Sent'.</p>
<p>The problem I have is that list correctly shows the packing lists within the ALL ... | [
{
"answer_id": 264112,
"author": "pck",
"author_id": 117960,
"author_profile": "https://wordpress.stackexchange.com/users/117960",
"pm_score": 2,
"selected": false,
"text": "<p>You should set the <code>public</code> argument to <code>true</code>. This way the post with 'inpacking' or 'se... | 2017/02/11 | [
"https://wordpress.stackexchange.com/questions/256117",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/113105/"
] | I've created a simple plugin for our WP site to allow us to enter in our products that we despatch.
To do this I've created a new Post Type called 'order\_packing' and within that 2 new Post Statuses: 'In Packing', 'Sent'.
The problem I have is that list correctly shows the packing lists within the ALL (2) total - bu... | You should set the `public` argument to `true`. This way the post with 'inpacking' or 'sent' `post_status` will also show in total.
So your code should be like this:
```
register_post_status( 'inpacking', array(
'label' => _x( 'In Packing', 'Order packing' ),
'public' =>... |
256,141 | <p>I have a site that has a membership. Currently, we allow customization of preset themes. This uses cookies, however I want my users to have the same theme across all of their devices. <strong>I want to be able to save the cookies to a users account.</strong> There has to be somehow to do this. The plugin I use for t... | [
{
"answer_id": 264112,
"author": "pck",
"author_id": 117960,
"author_profile": "https://wordpress.stackexchange.com/users/117960",
"pm_score": 2,
"selected": false,
"text": "<p>You should set the <code>public</code> argument to <code>true</code>. This way the post with 'inpacking' or 'se... | 2017/02/11 | [
"https://wordpress.stackexchange.com/questions/256141",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | I have a site that has a membership. Currently, we allow customization of preset themes. This uses cookies, however I want my users to have the same theme across all of their devices. **I want to be able to save the cookies to a users account.** There has to be somehow to do this. The plugin I use for theme switching i... | You should set the `public` argument to `true`. This way the post with 'inpacking' or 'sent' `post_status` will also show in total.
So your code should be like this:
```
register_post_status( 'inpacking', array(
'label' => _x( 'In Packing', 'Order packing' ),
'public' =>... |
256,149 | <p>At the bottom of my WP-admin pages I get this:</p>
<pre><code>ob_end_flush(): failed to send buffer of zlib output compression (1) in C:\Users\anticaking\Desktop\Website\wordpress\wp-includes\functions.php on line 3718.
</code></pre>
<p>Line 3718:</p>
<pre><code>function wp_ob_end_flush_all() {
$levels = ob_g... | [
{
"answer_id": 289783,
"author": "Madusanka",
"author_id": 134013,
"author_profile": "https://wordpress.stackexchange.com/users/134013",
"pm_score": 1,
"selected": false,
"text": "<p>bool ob_end_flush ( void )\nThis function will send the contents of the topmost output buffer (if any) an... | 2017/02/12 | [
"https://wordpress.stackexchange.com/questions/256149",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/111846/"
] | At the bottom of my WP-admin pages I get this:
```
ob_end_flush(): failed to send buffer of zlib output compression (1) in C:\Users\anticaking\Desktop\Website\wordpress\wp-includes\functions.php on line 3718.
```
Line 3718:
```
function wp_ob_end_flush_all() {
$levels = ob_get_level();
for ($i=0; $i<$levels... | I also had this issue with wordpress and couldn't properly resolve it. Ended up with this filthy hack to prevent the error from showing:
```
// Get the current error reporting level
$e_level = error_reporting();
// Turn off error reporting
error_reporting(0);
ob_start();
echo 'This is a horrible hack';
$buffer_conte... |
256,195 | <p>I'm using the theme "Tesseract" as a parent theme, and I'd like to use the walker class to get menu descriptions. However, I am having trouble figuring out how to edit the php, because I don't know how to properly replace the parent theme's functions.</p>
<h3>I need to change a parent theme's function</h3>
<p>Acco... | [
{
"answer_id": 256198,
"author": "CoderScissorhands",
"author_id": 105196,
"author_profile": "https://wordpress.stackexchange.com/users/105196",
"pm_score": 0,
"selected": false,
"text": "<p>I realized an easier approach that worked that involved editing my child's header.php file </p>\n... | 2017/02/12 | [
"https://wordpress.stackexchange.com/questions/256195",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/105196/"
] | I'm using the theme "Tesseract" as a parent theme, and I'd like to use the walker class to get menu descriptions. However, I am having trouble figuring out how to edit the php, because I don't know how to properly replace the parent theme's functions.
### I need to change a parent theme's function
According to [this ... | Go to your `functions.php` in your child theme add this:
```
function childtheme_override_tesseract_output_menu( $cont, $contClass, $location, $depth ) {
//tesseract_output_menu function code modified as you wish here
}
```
In your parent theme `functions.php`, wrap the `tesseract_output_menu` function like this... |
256,223 | <p>I trying this directly in my theme:</p>
<p><code>
$mods = $wp_customize->get_control('header_text');
if (isset($mods)) {
echo 'YES';
} else {
echo 'No';
}
</code>
But nothing happened. and in debug.log : undefined variable wp_customize...</p>
| [
{
"answer_id": 256224,
"author": "Adson Cicilioti",
"author_id": 71254,
"author_profile": "https://wordpress.stackexchange.com/users/71254",
"pm_score": 0,
"selected": false,
"text": "<p>Use <a href=\"https://codex.wordpress.org/Function_Reference/get_theme_mod\" rel=\"nofollow noreferre... | 2017/02/13 | [
"https://wordpress.stackexchange.com/questions/256223",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/71254/"
] | I trying this directly in my theme:
`$mods = $wp_customize->get_control('header_text');
if (isset($mods)) {
echo 'YES';
} else {
echo 'No';
}`
But nothing happened. and in debug.log : undefined variable wp\_customize... | I'm not sure what exactly you're trying to accomplish, but if you're wanting to manipulate customizer controls until the `customize_register` action has fired. So do something like this:
```
add_action( 'customize_register', function( $wp_customize ) {
$control = $wp_customize->get_control( 'header_text' );
if... |
256,241 | <p>I am trying to manually restore my WordPress site which has been backed up using Updraft plus plugin. I uploaded & extracted all the files to their respective folder. However, when I tried to upload database via PhpMyAdmin I got following error.
<a href="https://i.stack.imgur.com/M9etI.png" rel="nofollow norefer... | [
{
"answer_id": 256224,
"author": "Adson Cicilioti",
"author_id": 71254,
"author_profile": "https://wordpress.stackexchange.com/users/71254",
"pm_score": 0,
"selected": false,
"text": "<p>Use <a href=\"https://codex.wordpress.org/Function_Reference/get_theme_mod\" rel=\"nofollow noreferre... | 2017/02/13 | [
"https://wordpress.stackexchange.com/questions/256241",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/113183/"
] | I am trying to manually restore my WordPress site which has been backed up using Updraft plus plugin. I uploaded & extracted all the files to their respective folder. However, when I tried to upload database via PhpMyAdmin I got following error.
[](https://i.stack.imgu... | I'm not sure what exactly you're trying to accomplish, but if you're wanting to manipulate customizer controls until the `customize_register` action has fired. So do something like this:
```
add_action( 'customize_register', function( $wp_customize ) {
$control = $wp_customize->get_control( 'header_text' );
if... |
256,242 | <p>Here is my code.</p>
<pre><code>defined( 'ABSPATH' ) || exit;
namespace JSR;
class myClass{
...
}
</code></pre>
<p>This is giving below error</p>
<pre><code>Global code should be enclosed in global namespace declaration
</code></pre>
<p>Any idea how to fix it?</p>
| [
{
"answer_id": 256246,
"author": "Dave Romsey",
"author_id": 2807,
"author_profile": "https://wordpress.stackexchange.com/users/2807",
"pm_score": 3,
"selected": true,
"text": "<p>From the PHP manual on <a href=\"http://php.net/manual/en/language.namespaces.definition.php\" rel=\"nofollo... | 2017/02/13 | [
"https://wordpress.stackexchange.com/questions/256242",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/9821/"
] | Here is my code.
```
defined( 'ABSPATH' ) || exit;
namespace JSR;
class myClass{
...
}
```
This is giving below error
```
Global code should be enclosed in global namespace declaration
```
Any idea how to fix it? | From the PHP manual on [defining namespaces](http://php.net/manual/en/language.namespaces.definition.php):
>
> Namespaces are declared using the namespace keyword. **A file containing
> a namespace must declare the namespace at the top of the file before
> any other code - with one exception: the *declare* keyword.... |
256,251 | <p>I would like to lock whole WordPress site (all pages, all posts, whatever content I will add in the future) with login page same as for example it is made here (clear your cookies) <a href="http://facebook.com" rel="nofollow noreferrer">http://facebook.com</a>.</p>
<p>How to achieve this functionality?</p>
| [
{
"answer_id": 256246,
"author": "Dave Romsey",
"author_id": 2807,
"author_profile": "https://wordpress.stackexchange.com/users/2807",
"pm_score": 3,
"selected": true,
"text": "<p>From the PHP manual on <a href=\"http://php.net/manual/en/language.namespaces.definition.php\" rel=\"nofollo... | 2017/02/13 | [
"https://wordpress.stackexchange.com/questions/256251",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/43884/"
] | I would like to lock whole WordPress site (all pages, all posts, whatever content I will add in the future) with login page same as for example it is made here (clear your cookies) <http://facebook.com>.
How to achieve this functionality? | From the PHP manual on [defining namespaces](http://php.net/manual/en/language.namespaces.definition.php):
>
> Namespaces are declared using the namespace keyword. **A file containing
> a namespace must declare the namespace at the top of the file before
> any other code - with one exception: the *declare* keyword.... |
256,260 | <p>I'm using shortcode to process my HTML form. However, upon submit no result is being displayed. I'm not getting where I'm going wrong.</p>
<pre><code><?php
function installer(){
include('installer.php');
}
register_activation_hook( __file__, 'installer' ); //executes installer php when installing plugin to c... | [
{
"answer_id": 256265,
"author": "AddWeb Solution Pvt Ltd",
"author_id": 73643,
"author_profile": "https://wordpress.stackexchange.com/users/73643",
"pm_score": 2,
"selected": true,
"text": "<p>You missed <strong>name</strong> attribute of <code><input type=\"submit\" value=\"<?ph... | 2017/02/13 | [
"https://wordpress.stackexchange.com/questions/256260",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/112658/"
] | I'm using shortcode to process my HTML form. However, upon submit no result is being displayed. I'm not getting where I'm going wrong.
```
<?php
function installer(){
include('installer.php');
}
register_activation_hook( __file__, 'installer' ); //executes installer php when installing plugin to create new databas... | You missed **name** attribute of `<input type="submit" value="<?php _e('Submit'); ?>"/>` HTML tag.
i.e.
It should be looks like: `<input type="submit" name="Submit" value="<?php _e('Submit'); ?>"/>`
Else, You have to change if condition inside `function form_processing()`
**OLD:**
if(isset($\_POST['Submit'])){
**R... |
256,269 | <p>I m trying to extract the firstname and lastname fields of a user whose email-id I know, and I m trying to display those in a backend page using a plugin, can someone please give me a short code for that, I just can,t find where these values are stored</p>
| [
{
"answer_id": 256271,
"author": "Sonali",
"author_id": 84167,
"author_profile": "https://wordpress.stackexchange.com/users/84167",
"pm_score": 1,
"selected": false,
"text": "<p>You can use this:</p>\n\n<pre><code> $user = get_user_by( 'email', 'user@example.com' );/*$user gives you ... | 2017/02/13 | [
"https://wordpress.stackexchange.com/questions/256269",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/113198/"
] | I m trying to extract the firstname and lastname fields of a user whose email-id I know, and I m trying to display those in a backend page using a plugin, can someone please give me a short code for that, I just can,t find where these values are stored | You can use this:
```
$user = get_user_by( 'email', 'user@example.com' );/*$user gives you all data*/
$first_name = $user->first_name;/*$first_name gives you first name*/
$last_name = $user->last_name;
``` |
256,275 | <p>I have a WP site currently running 4.7.2 version, and I use version control system. I did check both file configurations and database, there is nothing to force the site to auto update, also there are no plugins installed for that purpose. Still the site keeps updates to the latest version. If I understand correctly... | [
{
"answer_id": 256271,
"author": "Sonali",
"author_id": 84167,
"author_profile": "https://wordpress.stackexchange.com/users/84167",
"pm_score": 1,
"selected": false,
"text": "<p>You can use this:</p>\n\n<pre><code> $user = get_user_by( 'email', 'user@example.com' );/*$user gives you ... | 2017/02/13 | [
"https://wordpress.stackexchange.com/questions/256275",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/113201/"
] | I have a WP site currently running 4.7.2 version, and I use version control system. I did check both file configurations and database, there is nothing to force the site to auto update, also there are no plugins installed for that purpose. Still the site keeps updates to the latest version. If I understand correctly wh... | You can use this:
```
$user = get_user_by( 'email', 'user@example.com' );/*$user gives you all data*/
$first_name = $user->first_name;/*$first_name gives you first name*/
$last_name = $user->last_name;
``` |
256,282 | <p>I have created a plugin in WordPress to sync posts from a third party API. </p>
<p>I have set a cron job to fetch data in every 10 minutes. If I'm logged in, cron is working, otherwise cron is not working.</p>
| [
{
"answer_id": 256285,
"author": "Thilak",
"author_id": 113208,
"author_profile": "https://wordpress.stackexchange.com/users/113208",
"pm_score": 0,
"selected": false,
"text": "<p>WordPress Import Corn is Not Working Properly. If Admin Login, then only the cron's are scheduled. This is d... | 2017/02/13 | [
"https://wordpress.stackexchange.com/questions/256282",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/93030/"
] | I have created a plugin in WordPress to sync posts from a third party API.
I have set a cron job to fetch data in every 10 minutes. If I'm logged in, cron is working, otherwise cron is not working. | The WP Cron .. which runs when user hit website .. Thus if there are no website visits, WP Cron never runs.
Now you can use 2 solutions.
```
Disable WP-Cron and use real cron job and then custom real cron job
```
<https://support.hostgator.com/articles/specialized-help/technical/wordpress/how-to-replace-wordpress-c... |
256,287 | <p>test .php </p>
<pre><code><div id="widget_dta"></div>
<script type="text/javascript" src="widget.js"></script>
<script type="text/javascript">
init_widget('john','robert');
</script>
</code></pre>
<p>widget.js</p>
<pre><code> (function() {
// Localize jQuery variable
va... | [
{
"answer_id": 256285,
"author": "Thilak",
"author_id": 113208,
"author_profile": "https://wordpress.stackexchange.com/users/113208",
"pm_score": 0,
"selected": false,
"text": "<p>WordPress Import Corn is Not Working Properly. If Admin Login, then only the cron's are scheduled. This is d... | 2017/02/13 | [
"https://wordpress.stackexchange.com/questions/256287",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/112990/"
] | test .php
```
<div id="widget_dta"></div>
<script type="text/javascript" src="widget.js"></script>
<script type="text/javascript">
init_widget('john','robert');
</script>
```
widget.js
```
(function() {
// Localize jQuery variable
var jQuery;
/******** Load jQuery if not present *********/
if (window... | The WP Cron .. which runs when user hit website .. Thus if there are no website visits, WP Cron never runs.
Now you can use 2 solutions.
```
Disable WP-Cron and use real cron job and then custom real cron job
```
<https://support.hostgator.com/articles/specialized-help/technical/wordpress/how-to-replace-wordpress-c... |
256,301 | <p>I'm trying to alter the search functionality of a WooCommerce store so when a user makes a query that matches a <code>product_tag</code> slug it returns the products that don't have that product tag assigned.</p>
<p>The logic behind this is showing all the products without gluten to a user who searches for "gluten"... | [
{
"answer_id": 256349,
"author": "nibnut",
"author_id": 111316,
"author_profile": "https://wordpress.stackexchange.com/users/111316",
"pm_score": 4,
"selected": true,
"text": "<p>I suspect you need an array for the terms - although I'm not sure why it would work with \"IN\" and not with ... | 2017/02/13 | [
"https://wordpress.stackexchange.com/questions/256301",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/45686/"
] | I'm trying to alter the search functionality of a WooCommerce store so when a user makes a query that matches a `product_tag` slug it returns the products that don't have that product tag assigned.
The logic behind this is showing all the products without gluten to a user who searches for "gluten".
My code is almost ... | I suspect you need an array for the terms - although I'm not sure why it would work with "IN" and not with "NOT IN"... But I'd try this:
```
function menta_pre_get_posts( $query ) {
if ( !is_admin() && $query->is_search() && $query->is_main_query() ) {
$term = get_term_by('slug', get_query_var('s'), 'product_tag')... |
256,320 | <pre><code><head>
<title>
<?php wp_title(''); ?>
</title>
</head>
</code></pre>
<p>This displays the page title in the title correctly everywhere except on the front page where it displays "Home | Motto...". How can I have the front page display the page title like it does everywhere ... | [
{
"answer_id": 256322,
"author": "Johansson",
"author_id": 94498,
"author_profile": "https://wordpress.stackexchange.com/users/94498",
"pm_score": 1,
"selected": false,
"text": "<p>I'm not very sure how is your title on other pages, but here is how you can modify your title:</p>\n\n<p><c... | 2017/02/13 | [
"https://wordpress.stackexchange.com/questions/256320",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/111846/"
] | ```
<head>
<title>
<?php wp_title(''); ?>
</title>
</head>
```
This displays the page title in the title correctly everywhere except on the front page where it displays "Home | Motto...". How can I have the front page display the page title like it does everywhere else on the site? | I'm not very sure how is your title on other pages, but here is how you can modify your title:
`<?php wp_title( '|', true, 'right' ); ?>`
This will show your Blog's name right to your page's title, which will have seo benefits. The `|` separator will be used here.
If you want to customize your title further, you can... |
256,351 | <p>I'd like to compress images once they're uploaded to media library. Is there any hook that fires once the image is uploaded and the image sizes generated?</p>
| [
{
"answer_id": 256352,
"author": "Nathan Johnson",
"author_id": 106269,
"author_profile": "https://wordpress.stackexchange.com/users/106269",
"pm_score": 5,
"selected": true,
"text": "<blockquote>\n <p>Is there any hook that fires once the image is uploaded and the image sizes generated... | 2017/02/13 | [
"https://wordpress.stackexchange.com/questions/256351",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/47664/"
] | I'd like to compress images once they're uploaded to media library. Is there any hook that fires once the image is uploaded and the image sizes generated? | >
> Is there any hook that fires once the image is uploaded and the image sizes generated?
>
>
>
[`wp_handle_upload`](https://developer.wordpress.org/reference/hooks/wp_handle_upload/) fires after the image is uploaded. After the follow-up question, I discovered that images would not be sized at this point.
```
a... |
256,368 | <p>I am using <code>acfvalue</code> variable to get value and use it in more than one shortcode, let me explain i want to store ACF value in one variable and then use that variable in 3 function and create 3 shortcode.</p>
<pre><code>$acfvalue = get_field( 'short_title' );
</code></pre>
<p>above code is getting ACF v... | [
{
"answer_id": 256352,
"author": "Nathan Johnson",
"author_id": 106269,
"author_profile": "https://wordpress.stackexchange.com/users/106269",
"pm_score": 5,
"selected": true,
"text": "<blockquote>\n <p>Is there any hook that fires once the image is uploaded and the image sizes generated... | 2017/02/14 | [
"https://wordpress.stackexchange.com/questions/256368",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/111081/"
] | I am using `acfvalue` variable to get value and use it in more than one shortcode, let me explain i want to store ACF value in one variable and then use that variable in 3 function and create 3 shortcode.
```
$acfvalue = get_field( 'short_title' );
```
above code is getting ACF value and storing in $acfvalue, now i ... | >
> Is there any hook that fires once the image is uploaded and the image sizes generated?
>
>
>
[`wp_handle_upload`](https://developer.wordpress.org/reference/hooks/wp_handle_upload/) fires after the image is uploaded. After the follow-up question, I discovered that images would not be sized at this point.
```
a... |
256,372 | <p>I am trying to setup a local environment on my Windows 10 machine (to knock out some overtime) but keep running into a problem. Let me start with my environment workflow on Mac OSX... I have developed many sites locally over the years using MAMP Pro, allowing me to have a host for each project. However, at home I ha... | [
{
"answer_id": 256419,
"author": "AddWeb Solution Pvt Ltd",
"author_id": 73643,
"author_profile": "https://wordpress.stackexchange.com/users/73643",
"pm_score": -1,
"selected": false,
"text": "<p>You have to add <strong>your project directory name</strong> into <strong>RewriteBase</stron... | 2017/02/14 | [
"https://wordpress.stackexchange.com/questions/256372",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/73064/"
] | I am trying to setup a local environment on my Windows 10 machine (to knock out some overtime) but keep running into a problem. Let me start with my environment workflow on Mac OSX... I have developed many sites locally over the years using MAMP Pro, allowing me to have a host for each project. However, at home I have ... | While not *really* a an answer when it comes to MAMP's problem on Windows. Installing WAMP and running WordPress there instead fixed this issue. |
256,393 | <p>I am using the <em>Co-authors plus</em> plugin on our web page because sometimes we have more authors of an article. It is working really fine until today. I used classic archive.php to list all posts of the author based on global settings (same post excerpt, thumbs, posts per page 6 – defined in global WordPress &a... | [
{
"answer_id": 256412,
"author": "Jan Hanzman Kohoutek",
"author_id": 113288,
"author_profile": "https://wordpress.stackexchange.com/users/113288",
"pm_score": 2,
"selected": false,
"text": "<p>Nevermind, I fixed it by changing query by author_name instead of ID\nWorks!</p>\n\n<pre><code... | 2017/02/14 | [
"https://wordpress.stackexchange.com/questions/256393",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/113288/"
] | I am using the *Co-authors plus* plugin on our web page because sometimes we have more authors of an article. It is working really fine until today. I used classic archive.php to list all posts of the author based on global settings (same post excerpt, thumbs, posts per page 6 – defined in global WordPress & theme PHPs... | Nevermind, I fixed it by changing query by author\_name instead of ID
Works!
```
$the_query = new WP_Query(
array(
'posts_per_page' => -1,
'author_name' => get_the_author_meta('nickname'),
)
);
```
We can close this question! |
256,410 | <p>I have a page on my wordpress site which adds file content to a div using <code>jquery.get</code>. The file being targeted is a wp-admin file. The problem is, since I added SSL certificate this file no longer loads. When I check the file which is actually loaded it appears to be the log in page.</p>
<p>Jquery Code:... | [
{
"answer_id": 256412,
"author": "Jan Hanzman Kohoutek",
"author_id": 113288,
"author_profile": "https://wordpress.stackexchange.com/users/113288",
"pm_score": 2,
"selected": false,
"text": "<p>Nevermind, I fixed it by changing query by author_name instead of ID\nWorks!</p>\n\n<pre><code... | 2017/02/14 | [
"https://wordpress.stackexchange.com/questions/256410",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/76021/"
] | I have a page on my wordpress site which adds file content to a div using `jquery.get`. The file being targeted is a wp-admin file. The problem is, since I added SSL certificate this file no longer loads. When I check the file which is actually loaded it appears to be the log in page.
Jquery Code:
```
jQuery.get('/wp... | Nevermind, I fixed it by changing query by author\_name instead of ID
Works!
```
$the_query = new WP_Query(
array(
'posts_per_page' => -1,
'author_name' => get_the_author_meta('nickname'),
)
);
```
We can close this question! |
256,428 | <p>I have four post types</p>
<ol>
<li>Products</li>
<li>Banners</li>
<li>Portfolio</li>
<li>Testimonials</li>
</ol>
<p>And they all display their posts on the same home page template (index.php).</p>
<p>Currently using below query to get posts from different post types.</p>
<pre><code><?php
query_posts(
arr... | [
{
"answer_id": 256433,
"author": "Industrial Themes",
"author_id": 274,
"author_profile": "https://wordpress.stackexchange.com/users/274",
"pm_score": 1,
"selected": false,
"text": "<p>Best practice would be to use four different custom queries and loop through each one separately using ... | 2017/02/14 | [
"https://wordpress.stackexchange.com/questions/256428",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/38229/"
] | I have four post types
1. Products
2. Banners
3. Portfolio
4. Testimonials
And they all display their posts on the same home page template (index.php).
Currently using below query to get posts from different post types.
```
<?php
query_posts(
array(
'post_type' => 'work_projects',
'work_type' =>... | `post_type` accepts an array.
Have you tried using `WP_Query` with an array?
```
$args = array(
'post_type' => array( 'product', 'banner', 'portfolio', 'testimonial'),
'post_status' => 'publish',
'posts_per_page' => 100
);
$the_query = new WP_Query( $args );
``` |
256,429 | <p>I am creating a custom post type for a front-end slider. It takes the value entered into a custom field and uses it as post-title. It works perfectly on my localhost and on my personal host. However, when I install it on my client's host, I am given the following error:</p>
<pre><code>Notice: Undefined index: wys_s... | [
{
"answer_id": 256441,
"author": "Laxmana",
"author_id": 40948,
"author_profile": "https://wordpress.stackexchange.com/users/40948",
"pm_score": 0,
"selected": false,
"text": "<p>I would remove the <code>wys_slide_title</code> filter and move the logic inside <code>save_post</code> actio... | 2017/02/14 | [
"https://wordpress.stackexchange.com/questions/256429",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/36204/"
] | I am creating a custom post type for a front-end slider. It takes the value entered into a custom field and uses it as post-title. It works perfectly on my localhost and on my personal host. However, when I install it on my client's host, I am given the following error:
```
Notice: Undefined index: wys_slider_title in... | I would suggest the following improvements for better code readability and to make it easier to maintain later.
1. Assuming you've removed **title** from your custom post type using the following function :
```
remove_post_type_support( 'slider', 'title' )
```
Now if you use `name="post_title"` instead of `name="wy... |
256,438 | <p>I want to include an SVG icon file after the body tag and I'm using this code:</p>
<pre><code><?php include_once("assets/img/sprites.svg"); ?>
</code></pre>
<p>But I get this error:</p>
<blockquote>
<p>Parse error: syntax error, unexpected T_STRING in /home/ostadba1/public_html/wp-content/themes/ostad/ass... | [
{
"answer_id": 256442,
"author": "Johansson",
"author_id": 94498,
"author_profile": "https://wordpress.stackexchange.com/users/94498",
"pm_score": 0,
"selected": false,
"text": "<p>The command <code>include_once()</code> is used to include php files. SVG is just an image file, it should ... | 2017/02/14 | [
"https://wordpress.stackexchange.com/questions/256438",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/107115/"
] | I want to include an SVG icon file after the body tag and I'm using this code:
```
<?php include_once("assets/img/sprites.svg"); ?>
```
But I get this error:
>
> Parse error: syntax error, unexpected T\_STRING in /home/ostadba1/public\_html/wp-content/themes/ostad/assets/img/sprites.svg on line 1
>
>
>
the pur... | It's because that's not how you should include an SVG in PHP,
`include_once` is used for including PHP files.
Reason behind this error:
```
PHP Parse error: syntax error, unexpected version (T_STRING)
```
is that PHP was unable to parse the beginning of the SVG file at the point where the XML version was def... |
256,439 | <p>Im using Calculated Form Fields plugin for a Wordpress website. I already created the form I needed, but now I need to add the calculated price from the form as a URL parameter dynamically, when the button bellow the form is clicked. </p>
<p>The website uses Visual Composer and this is the button html:</p>
<pre><c... | [
{
"answer_id": 256442,
"author": "Johansson",
"author_id": 94498,
"author_profile": "https://wordpress.stackexchange.com/users/94498",
"pm_score": 0,
"selected": false,
"text": "<p>The command <code>include_once()</code> is used to include php files. SVG is just an image file, it should ... | 2017/02/14 | [
"https://wordpress.stackexchange.com/questions/256439",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/112015/"
] | Im using Calculated Form Fields plugin for a Wordpress website. I already created the form I needed, but now I need to add the calculated price from the form as a URL parameter dynamically, when the button bellow the form is clicked.
The website uses Visual Composer and this is the button html:
```
<a class="nectar-... | It's because that's not how you should include an SVG in PHP,
`include_once` is used for including PHP files.
Reason behind this error:
```
PHP Parse error: syntax error, unexpected version (T_STRING)
```
is that PHP was unable to parse the beginning of the SVG file at the point where the XML version was def... |
256,454 | <p>The admin panel of my WordPress (4.7.2) installation on my hosting (godaddy) has "Links" section enabled.</p>
<p>I set it up a few seconds ago with storefront theme. Then removed storefront and activated starter theme _S (underscores).</p>
<p>Even though I <strong>did not</strong> use following code, the links sec... | [
{
"answer_id": 256458,
"author": "Pat J",
"author_id": 16121,
"author_profile": "https://wordpress.stackexchange.com/users/16121",
"pm_score": 1,
"selected": false,
"text": "<p>Is this a brand-new site, or one that you've recently upgraded to 4.7.2? If the latter, here's one possibility:... | 2017/02/14 | [
"https://wordpress.stackexchange.com/questions/256454",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/112778/"
] | The admin panel of my WordPress (4.7.2) installation on my hosting (godaddy) has "Links" section enabled.
I set it up a few seconds ago with storefront theme. Then removed storefront and activated starter theme \_S (underscores).
Even though I **did not** use following code, the links section is visible. Why is that?... | If you install WordPress using the GoDaddy cPanel then GoDaddy will automatically install a number of [Must Use Plugins](https://codex.wordpress.org/Must_Use_Plugins) in your installation. These plugins are invisible and you can't disable them by normal means. One of these plugins is enabling the Link Manager.
Aside: ... |
256,457 | <p>I've installed WordPress and setup the database.<br>
I go to the address and the setup page is there, but no CSS.<br>
I think: something's wrong, but if I just do the setup maybe everything will just go back to normal.<br>
No.<br>
So then I spend a while looking through search results for WordPress styles not worki... | [
{
"answer_id": 256461,
"author": "Pat J",
"author_id": 16121,
"author_profile": "https://wordpress.stackexchange.com/users/16121",
"pm_score": 4,
"selected": false,
"text": "<p>Check your <code>wp-config.php</code> file for lines like:</p>\n\n<pre><code>define( 'WP_SITEURL', 'https://exa... | 2017/02/14 | [
"https://wordpress.stackexchange.com/questions/256457",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/113319/"
] | I've installed WordPress and setup the database.
I go to the address and the setup page is there, but no CSS.
I think: something's wrong, but if I just do the setup maybe everything will just go back to normal.
No.
So then I spend a while looking through search results for WordPress styles not working etc. ... | Check your `wp-config.php` file for lines like:
```
define( 'WP_SITEURL', 'https://example.com' );
define( 'WP_HOME', 'https://example.com' );
```
Also check your database's `{prefix}_options` table:
```
SELECT * FROM wp_options WHERE option_name='siteurl' OR option_name='home';
```
...assuming that your datab... |
256,510 | <p>I can't find answer to my question, just hope you will find it relevant.</p>
<p>I'm working a magazine website and I need to display names of contributors in a list by family names. The contributors have been created by a custom taxonomy. Some of those names have <strong>more than one First names</strong>.</p>
<p>... | [
{
"answer_id": 256591,
"author": "CodeMascot",
"author_id": 44192,
"author_profile": "https://wordpress.stackexchange.com/users/44192",
"pm_score": 1,
"selected": false,
"text": "<p>Hope the below code block will help you. Please read the comments carefully. The code block-</p>\n\n<pre><... | 2017/02/15 | [
"https://wordpress.stackexchange.com/questions/256510",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/6695/"
] | I can't find answer to my question, just hope you will find it relevant.
I'm working a magazine website and I need to display names of contributors in a list by family names. The contributors have been created by a custom taxonomy. Some of those names have **more than one First names**.
Example
**S**
Jane Gabriella... | So I finally been able to solve my problem by using two fields that I added to my custom taxonony called "Contributors". One for the admin of the site to write the family name of each contributor and a field to tell in which letter group it belong.
I'm sure there would be easier way to code this but, with my limited n... |
256,547 | <p>I am currently using the GeoDirectory add-on for Wordpress and as of late, I haven't made any changes to Wordpress other than the fact that wordpress has upgraded to the latest version. </p>
<p>When I add an event, without a package then JQuery appears to be working fine, everything on the page appears and works th... | [
{
"answer_id": 256552,
"author": "TrubinE",
"author_id": 111011,
"author_profile": "https://wordpress.stackexchange.com/users/111011",
"pm_score": 1,
"selected": false,
"text": "<p>When connecting your scripts indicate that the script should work when connected to jQuery:</p>\n\n<pre><co... | 2017/02/15 | [
"https://wordpress.stackexchange.com/questions/256547",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/113383/"
] | I am currently using the GeoDirectory add-on for Wordpress and as of late, I haven't made any changes to Wordpress other than the fact that wordpress has upgraded to the latest version.
When I add an event, without a package then JQuery appears to be working fine, everything on the page appears and works the way it s... | There are this type of problem occure. In case-
**1-** jQuery function conflict to other jquery function.
To remove this type of problem, define below script in **wp-config.php** file.
```
define('CONCATENATE_SCRIPTS', false);
```
**2-** jQuery liberaray file are not include in frontend.
**3-** Jquery same file d... |
256,558 | <p>i have enable permalinks on my wordpress site and now every page returns 404 error. The site is hosted in IIS 8.5</p>
<p>the web.config file has the following rule inside</p>
<pre><code><?xml version="1.0" encoding="UTF-8"?>
</code></pre>
<p>
</p>
<pre><code><directoryBrowse enabled="false"/>
<r... | [
{
"answer_id": 256552,
"author": "TrubinE",
"author_id": 111011,
"author_profile": "https://wordpress.stackexchange.com/users/111011",
"pm_score": 1,
"selected": false,
"text": "<p>When connecting your scripts indicate that the script should work when connected to jQuery:</p>\n\n<pre><co... | 2017/02/15 | [
"https://wordpress.stackexchange.com/questions/256558",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/110915/"
] | i have enable permalinks on my wordpress site and now every page returns 404 error. The site is hosted in IIS 8.5
the web.config file has the following rule inside
```
<?xml version="1.0" encoding="UTF-8"?>
```
```
<directoryBrowse enabled="false"/>
<rewrite>
<rules>
<clear/>
<rule name="wordpress" stop... | There are this type of problem occure. In case-
**1-** jQuery function conflict to other jquery function.
To remove this type of problem, define below script in **wp-config.php** file.
```
define('CONCATENATE_SCRIPTS', false);
```
**2-** jQuery liberaray file are not include in frontend.
**3-** Jquery same file d... |
256,569 | <p>I am using ultimate <a href="https://wordpress.org/plugins/ultimate-product-catalogue/" rel="nofollow noreferrer">Product Catalog plugin</a> in WordPress. Currently only Administrator role users are able to view the plugin settings.</p>
<p>But I need Editor, Contributor, and Author role users also has to have acces... | [
{
"answer_id": 256628,
"author": "I'm Joe Too",
"author_id": 60972,
"author_profile": "https://wordpress.stackexchange.com/users/60972",
"pm_score": 0,
"selected": false,
"text": "<p>Use <code>current_user_can( 'edit_posts' )</code> which applies to any logged in user above subscriber. A... | 2017/02/15 | [
"https://wordpress.stackexchange.com/questions/256569",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/113391/"
] | I am using ultimate [Product Catalog plugin](https://wordpress.org/plugins/ultimate-product-catalogue/) in WordPress. Currently only Administrator role users are able to view the plugin settings.
But I need Editor, Contributor, and Author role users also has to have access to view the specific plugin. Can anyone pleas... | Got a fix for this.
Get current user id and based on ID get current user info.From that user info get user role. If user role is not subscriber then only we can add menu page. This way editors/contributors can access plugin.
Below is the working code.
```
<?php
$userID = get_current_user_id();
$user = new ... |
256,570 | <p>My WordPress blog is set up as <code>nl_NL</code>. This means that my <a href="http://booking-wp-plugin.com/" rel="nofollow noreferrer">bookly plugin</a> is also displayed in <code>nl_NL</code>.</p>
<p>In the Plugin directory there is a folder languages with loads of other languages.</p>
<p>I have one page in thre... | [
{
"answer_id": 256628,
"author": "I'm Joe Too",
"author_id": 60972,
"author_profile": "https://wordpress.stackexchange.com/users/60972",
"pm_score": 0,
"selected": false,
"text": "<p>Use <code>current_user_can( 'edit_posts' )</code> which applies to any logged in user above subscriber. A... | 2017/02/15 | [
"https://wordpress.stackexchange.com/questions/256570",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/113384/"
] | My WordPress blog is set up as `nl_NL`. This means that my [bookly plugin](http://booking-wp-plugin.com/) is also displayed in `nl_NL`.
In the Plugin directory there is a folder languages with loads of other languages.
I have one page in three different languages `nl_NL`, `de_DE`, `en_EN`, on this page I would like t... | Got a fix for this.
Get current user id and based on ID get current user info.From that user info get user role. If user role is not subscriber then only we can add menu page. This way editors/contributors can access plugin.
Below is the working code.
```
<?php
$userID = get_current_user_id();
$user = new ... |
256,580 | <p>I am trying to load a full width video on my homepage. My situation is almost exactly like:
<a href="https://wordpress.stackexchange.com/questions/226303/video-background-php-css-generating-404-error-on-page-load-wordpress-t/226421">Video Background - (php & css) - generating 404 error on page load - Wordpress... | [
{
"answer_id": 256628,
"author": "I'm Joe Too",
"author_id": 60972,
"author_profile": "https://wordpress.stackexchange.com/users/60972",
"pm_score": 0,
"selected": false,
"text": "<p>Use <code>current_user_can( 'edit_posts' )</code> which applies to any logged in user above subscriber. A... | 2017/02/15 | [
"https://wordpress.stackexchange.com/questions/256580",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/113398/"
] | I am trying to load a full width video on my homepage. My situation is almost exactly like:
[Video Background - (php & css) - generating 404 error on page load - Wordpress Theme File Structure Help](https://wordpress.stackexchange.com/questions/226303/video-background-php-css-generating-404-error-on-page-load-wordpres... | Got a fix for this.
Get current user id and based on ID get current user info.From that user info get user role. If user role is not subscriber then only we can add menu page. This way editors/contributors can access plugin.
Below is the working code.
```
<?php
$userID = get_current_user_id();
$user = new ... |
256,590 | <p>I've noticed that WordPress does not generate a thumbnail for an image if the uploaded image's size is the same as the thumbnail's size. </p>
<p>To make this clear, here is an example: </p>
<p>I have an image with a size of <code>300x200px</code>. My thumbnail's size in the WordPress setting is also <code>300x200<... | [
{
"answer_id": 256620,
"author": "Jeff82",
"author_id": 77924,
"author_profile": "https://wordpress.stackexchange.com/users/77924",
"pm_score": -1,
"selected": false,
"text": "<p>Wordpress should automatically create all specified sizes of an image when it's uploaded to the media library... | 2017/02/15 | [
"https://wordpress.stackexchange.com/questions/256590",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/94498/"
] | I've noticed that WordPress does not generate a thumbnail for an image if the uploaded image's size is the same as the thumbnail's size.
To make this clear, here is an example:
I have an image with a size of `300x200px`. My thumbnail's size in the WordPress setting is also `300x200`. So, when i upload this image, n... | If I understand the question correctly, you want to generate
```
test.jpg
test-150x150.jpg
```
instead of just:
```
test.jpg
```
when you upload an image called `test.jpg`, of size 150x150, the same as the *thumbnail* size. (*I used the 150x150 size here instead of your 300x200 to avoid confusing it with the med... |
256,592 | <p>I'd like to grab a random post but only one which has a post excerpt. Is there any way that I can query this during a call to <code>get_posts()</code> or <code>wp_query()</code>? </p>
<p>Bonus points if I could do it with REST, I explored down that route and found myself back at <code>get_posts()</code>.</p>
| [
{
"answer_id": 256594,
"author": "Ben Lonsdale",
"author_id": 110488,
"author_profile": "https://wordpress.stackexchange.com/users/110488",
"pm_score": 1,
"selected": true,
"text": "<p>Something along these lines should work, not tested for syntax errors though</p>\n\n<pre><code> ... | 2017/02/15 | [
"https://wordpress.stackexchange.com/questions/256592",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/45504/"
] | I'd like to grab a random post but only one which has a post excerpt. Is there any way that I can query this during a call to `get_posts()` or `wp_query()`?
Bonus points if I could do it with REST, I explored down that route and found myself back at `get_posts()`. | Something along these lines should work, not tested for syntax errors though
```
function random_post() {
$args = array(
'post_type' => 'post',
'orderby' => 'rand',
'posts_per_page' => 1,
);
$post = query_posts( $args );
}
... |
256,593 | <p>My WordPress site got hacked and the WP Admin user account password was changed by the hacker. This essentially locked the user out of his admin dashboard. It is best (for situations like this) to just create a new admin user account to gain access to WP admin dashboard and fix things as needed.</p>
<p>Is it possib... | [
{
"answer_id": 256596,
"author": "CodeMascot",
"author_id": 44192,
"author_profile": "https://wordpress.stackexchange.com/users/44192",
"pm_score": 3,
"selected": true,
"text": "<p>You need to run those below queries-</p>\n\n<pre><code>INSERT INTO `your-wp-database`.`wp_users` (`ID`, `us... | 2017/02/15 | [
"https://wordpress.stackexchange.com/questions/256593",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/106731/"
] | My WordPress site got hacked and the WP Admin user account password was changed by the hacker. This essentially locked the user out of his admin dashboard. It is best (for situations like this) to just create a new admin user account to gain access to WP admin dashboard and fix things as needed.
Is it possible to crea... | You need to run those below queries-
```
INSERT INTO `your-wp-database`.`wp_users` (`ID`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_status`, `display_name`) VALUES ('1000', 'your_username', MD5('Str0ngPa55!'), 'your_username', 'you-user@email.com', '0', 'User Display Name');
INSERT INTO `your-wp... |
256,629 | <p>I have a problem and would like some help:</p>
<p>Scenario:</p>
<p>Table: wp_usermeta</p>
<p><a href="https://i.stack.imgur.com/S3OFd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/S3OFd.png" alt="enter image description here"></a></p>
<p>According to the table above (wp-usermeta), which func... | [
{
"answer_id": 256630,
"author": "smartcat",
"author_id": 112935,
"author_profile": "https://wordpress.stackexchange.com/users/112935",
"pm_score": 3,
"selected": true,
"text": "<p>This should do the trick. Add this filter to your plugins functions file/class. This will run automatically... | 2017/02/15 | [
"https://wordpress.stackexchange.com/questions/256629",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/113413/"
] | I have a problem and would like some help:
Scenario:
Table: wp\_usermeta
[](https://i.stack.imgur.com/S3OFd.png)
According to the table above (wp-usermeta), which function could I use for all users with Special Plan after login being redirected to ... | This should do the trick. Add this filter to your plugins functions file/class. This will run automatically every time anyone logs in, if they are a user who has the 'Vip' plan, they will be redirected to the `/vip/` page. otherwise they will be redirected to the default.
```
add_filter( 'login_redirect', function( $r... |
256,653 | <p>Is it possible to hide or remove some custom post type from here?
<a href="https://i.stack.imgur.com/6jNVx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6jNVx.png" alt="here are the screenshot"></a></p>
| [
{
"answer_id": 256656,
"author": "Fayaz",
"author_id": 110572,
"author_profile": "https://wordpress.stackexchange.com/users/110572",
"pm_score": 2,
"selected": false,
"text": "<p>If you have created the custom post type correctly, hiding it should be easy.</p>\n\n<p>First, from your your... | 2017/02/16 | [
"https://wordpress.stackexchange.com/questions/256653",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/50526/"
] | Is it possible to hide or remove some custom post type from here?
[](https://i.stack.imgur.com/6jNVx.png) | If you have created the custom post type correctly, hiding it should be easy.
First, from your your Admin Panel, go to:
```
Appearance -> Menus
```
Then, from there at the top right, you'll see `Screen Options` button. If you click that button, it'll show you the option to show & hide `Pages`, `Posts`, `Your Custom... |
256,662 | <p>I need to add a chat widget in HTML, css and js, on all WP website. I tried the following in local (functions.php) and it worked fine but just on homepage. Same code online and nothing shows up. Any advice? Thank you in advance :)</p>
<pre><code><?php
function add_chat ( ) {
?>
<scri... | [
{
"answer_id": 256656,
"author": "Fayaz",
"author_id": 110572,
"author_profile": "https://wordpress.stackexchange.com/users/110572",
"pm_score": 2,
"selected": false,
"text": "<p>If you have created the custom post type correctly, hiding it should be easy.</p>\n\n<p>First, from your your... | 2017/02/16 | [
"https://wordpress.stackexchange.com/questions/256662",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/113452/"
] | I need to add a chat widget in HTML, css and js, on all WP website. I tried the following in local (functions.php) and it worked fine but just on homepage. Same code online and nothing shows up. Any advice? Thank you in advance :)
```
<?php
function add_chat ( ) {
?>
<script type="text/javascrip... | If you have created the custom post type correctly, hiding it should be easy.
First, from your your Admin Panel, go to:
```
Appearance -> Menus
```
Then, from there at the top right, you'll see `Screen Options` button. If you click that button, it'll show you the option to show & hide `Pages`, `Posts`, `Your Custom... |