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 |
|---|---|---|---|---|---|---|
288,301 | <p>I tried many many times, I read many examples but my .htaccess is not working.
My domain is: liebeundsprueche.com/
When I go to www.liebeundsprueche.com/ it doesn't redirect me to liebeundsprueche.com/
Here is my .htaccess file:</p>
<pre><code># BEGIN WordPress
<IfModule mod_rewrite.c>
DirectoryIndex index.p... | [
{
"answer_id": 288402,
"author": "scytale",
"author_id": 128374,
"author_profile": "https://wordpress.stackexchange.com/users/128374",
"pm_score": 1,
"selected": false,
"text": "<p>Stage and Prod may be on the same server but are they configured for the same version of PHP?</p>\n\n<p>A W... | 2017/12/11 | [
"https://wordpress.stackexchange.com/questions/288301",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/133070/"
] | I tried many many times, I read many examples but my .htaccess is not working.
My domain is: liebeundsprueche.com/
When I go to www.liebeundsprueche.com/ it doesn't redirect me to liebeundsprueche.com/
Here is my .htaccess file:
```
# BEGIN WordPress
<IfModule mod_rewrite.c>
DirectoryIndex index.php
RewriteEngine on
R... | You can create your own custom error handler and add stack trace to your error log.
```
set_error_handler('wpse_288408_handle_error');
function wpse_288408_handle_error( $errno, $errstr, $errfile, $errline ) {
if( $errno === E_USER_NOTICE ) {
$message = 'You have an error notice: "%s" in file "%s" at li... |
288,307 | <p>In my plugin I'm using </p>
<p><code>add_filter('wp_insert_post_data','filter_blog_post_data');</code> </p>
<p>for filtering blog data before it gets saved in the database.</p>
<p>However this hook makes <code>post-new.php</code> to load latest post's data, like permalink, slug, author.</p>
<p><a href="https://i... | [
{
"answer_id": 288311,
"author": "Sid",
"author_id": 110516,
"author_profile": "https://wordpress.stackexchange.com/users/110516",
"pm_score": 1,
"selected": false,
"text": "<p>Not sure what must be causing this. Try replicating your entire filter hook with function in this format:</p>\n... | 2017/12/11 | [
"https://wordpress.stackexchange.com/questions/288307",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/133017/"
] | In my plugin I'm using
`add_filter('wp_insert_post_data','filter_blog_post_data');`
for filtering blog data before it gets saved in the database.
However this hook makes `post-new.php` to load latest post's data, like permalink, slug, author.
[](... | Not sure what must be causing this. Try replicating your entire filter hook with function in this format:
```
function filter_handler( $data ) {
// do something with the post data
return $data;
}
add_filter( 'wp_insert_post_data', 'filter_handler', '10', 1);
```
Let me know if something happens. |
288,345 | <p>I have a client who wants to display home plans (a custom post type) on their website in 2 differently branded sections, depending on which listing page the post is accessed from. I found this solution from @gmazzap from a few years ago, and it looks promising, but I can't make it work: <a href="https://wordpress.st... | [
{
"answer_id": 288389,
"author": "kierzniak",
"author_id": 132363,
"author_profile": "https://wordpress.stackexchange.com/users/132363",
"pm_score": 3,
"selected": true,
"text": "<p>To display different templates for the same post type I would make 2 different links, check on which link ... | 2017/12/11 | [
"https://wordpress.stackexchange.com/questions/288345",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/30/"
] | I have a client who wants to display home plans (a custom post type) on their website in 2 differently branded sections, depending on which listing page the post is accessed from. I found this solution from @gmazzap from a few years ago, and it looks promising, but I can't make it work: [Multiple templates for custom p... | To display different templates for the same post type I would make 2 different links, check on which link I'm currently on and decide which template to load.
Working example:
```
/**
* Register event post type
*
* Registering event post type will add such a permalink structure event/([^/]+)/?$
*/
function wpse_28... |
288,363 | <p>I am receiving this notice when trying to use the $wpdb->prepare function:</p>
<blockquote>
<p>Notice: wpdb::prepare was called <strong>incorrectly</strong>. The
query does not contain the correct number of placeholders (7) for the
number of arguments passed (4). Please see Debugging in
WordPress for more i... | [
{
"answer_id": 288365,
"author": "Tom J Nowell",
"author_id": 736,
"author_profile": "https://wordpress.stackexchange.com/users/736",
"pm_score": 1,
"selected": false,
"text": "<p>The <code>wpdb::prepare</code> says that you should not quote placeholders, yet in your code there is:</p>\n... | 2017/12/12 | [
"https://wordpress.stackexchange.com/questions/288363",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/58254/"
] | I am receiving this notice when trying to use the $wpdb->prepare function:
>
> Notice: wpdb::prepare was called **incorrectly**. The
> query does not contain the correct number of placeholders (7) for the
> number of arguments passed (4). Please see Debugging in
> WordPress for more information. (This message was ... | Numbered placeholders don't work as you'd expect, and are going to be removed altogether at some point in the future, so should be considered invalid syntax.
So with this in mind, the error describes the problem- your query has 7 placeholders, but you only pass 4 values. For the repeated values, you just need to repea... |
288,381 | <p>I need to remove description textarea from a custom taxonomy edit screen in admin.</p>
<p>I'm actually doing this with the following jQuery line</p>
<pre><code>$('.form-field.term-description-wrap').remove();
</code></pre>
<p>but I would like doing it in PHP. Is it possible?</p>
<p>I'm looking at the <strong>{$t... | [
{
"answer_id": 288382,
"author": "Jacob Peattie",
"author_id": 39152,
"author_profile": "https://wordpress.stackexchange.com/users/39152",
"pm_score": 0,
"selected": false,
"text": "<p>It's not possible, there's no hook. The hook you mentioned is an <em>action</em>, not a filter, and can... | 2017/12/12 | [
"https://wordpress.stackexchange.com/questions/288381",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/85556/"
] | I need to remove description textarea from a custom taxonomy edit screen in admin.
I'm actually doing this with the following jQuery line
```
$('.form-field.term-description-wrap').remove();
```
but I would like doing it in PHP. Is it possible?
I'm looking at the **{$taxonomy}\_edit\_form\_fields** hook. Is this t... | check out [this thread](https://wordpress.stackexchange.com/questions/56569/remove-the-category-taxonomy-description-field) - I'm afraid nothing has changed since then, there is still no way of filtering the description field (it's just html hardcoded in the file <https://github.com/WordPress/WordPress/blob/master/wp-a... |
288,391 | <p>So I was asked to add some analytics code to a sponsored post. I usually do it like this:</p>
<pre><code>if(is_single('post_slug')):
// Insert analytics code;
endif;
</code></pre>
<p>However, I cannot figure out how to do it on a post with a custom post type.</p>
<p>I found this function which takes the slug of t... | [
{
"answer_id": 288398,
"author": "kierzniak",
"author_id": 132363,
"author_profile": "https://wordpress.stackexchange.com/users/132363",
"pm_score": 1,
"selected": false,
"text": "<p>You can mix two functions:</p>\n\n<pre><code>if( is_singular( $post_type ) && is_single( $post_sl... | 2017/12/12 | [
"https://wordpress.stackexchange.com/questions/288391",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/133129/"
] | So I was asked to add some analytics code to a sponsored post. I usually do it like this:
```
if(is_single('post_slug')):
// Insert analytics code;
endif;
```
However, I cannot figure out how to do it on a post with a custom post type.
I found this function which takes the slug of the custom post type:
is\_singula... | You can mix two functions:
```
if( is_singular( $post_type ) && is_single( $post_slug ) ):
// Insert analytics code;
endif;
``` |
288,407 | <p>I added post_meta 'batch' to 'assignment' custom post as follows:</p>
<pre><code>update_post_meta( $id, 'batch', strip_tags($_POST['batch']));
</code></pre>
<p>Now I am trying to retrieve this data as follows:</p>
<pre><code>$args = array(
'post_type' => 'assignment',
'post_status' => 'publish',
)... | [
{
"answer_id": 288398,
"author": "kierzniak",
"author_id": 132363,
"author_profile": "https://wordpress.stackexchange.com/users/132363",
"pm_score": 1,
"selected": false,
"text": "<p>You can mix two functions:</p>\n\n<pre><code>if( is_singular( $post_type ) && is_single( $post_sl... | 2017/12/12 | [
"https://wordpress.stackexchange.com/questions/288407",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/120824/"
] | I added post\_meta 'batch' to 'assignment' custom post as follows:
```
update_post_meta( $id, 'batch', strip_tags($_POST['batch']));
```
Now I am trying to retrieve this data as follows:
```
$args = array(
'post_type' => 'assignment',
'post_status' => 'publish',
);
$assignments = new WP_Query( $args );
... | You can mix two functions:
```
if( is_singular( $post_type ) && is_single( $post_slug ) ):
// Insert analytics code;
endif;
``` |
288,416 | <p>How do I retrieve the IDs of unattached media in my post?</p>
<p>I have two posts: <strong>POST A</strong> and <strong>POST B</strong> and a PDF file called <strong>file.pdf</strong>.</p>
<p>I've uploaded <strong>file.pdf</strong> to <strong>POST A</strong> but then also inserted it in <strong>POST B</strong>.</p>... | [
{
"answer_id": 288421,
"author": "bueltge",
"author_id": 170,
"author_profile": "https://wordpress.stackexchange.com/users/170",
"pm_score": 0,
"selected": false,
"text": "<p>it is not easy to get an short hint, source code to find all usages of an media file. WordPress creates an relati... | 2017/12/12 | [
"https://wordpress.stackexchange.com/questions/288416",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/101988/"
] | How do I retrieve the IDs of unattached media in my post?
I have two posts: **POST A** and **POST B** and a PDF file called **file.pdf**.
I've uploaded **file.pdf** to **POST A** but then also inserted it in **POST B**.
Now the **file.pdf** is still attached to **POST A** so I'm not able to get it's ID by using `get... | Yes you can do this! Is it simple/easy? Sort of... Is it fast and scalable? Oh dear god no .
The Super Expensive Solution
----------------------------
The solution here is this function:
```
$post_id = url_to_postid( $url );
```
The problem is that this is a very slow function that's expensive to call. If you call... |
288,434 | <p>When I embed a Youtube video onto my page, is there a way to change the thumbnail displayed (<a href="https://imgur.com/F4daH3U" rel="nofollow noreferrer">screenshot</a>)? I do not have admin access to the Youtube video in-question.</p>
<p>I would prefer a non-plugin solution if possible. I found <a href="http://... | [
{
"answer_id": 288436,
"author": "Nicolai Grossherr",
"author_id": 22534,
"author_profile": "https://wordpress.stackexchange.com/users/22534",
"pm_score": 3,
"selected": true,
"text": "<p>The <a href=\"https://codex.wordpress.org/Video_Shortcode\" rel=\"nofollow noreferrer\"><code>[video... | 2017/12/12 | [
"https://wordpress.stackexchange.com/questions/288434",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/51204/"
] | When I embed a Youtube video onto my page, is there a way to change the thumbnail displayed ([screenshot](https://imgur.com/F4daH3U))? I do not have admin access to the Youtube video in-question.
I would prefer a non-plugin solution if possible. I found [these instructions](http://wpdecoder.com/video-tutorials/custom-... | The [`[video]` shortcode](https://codex.wordpress.org/Video_Shortcode) can be used with the `src` being an URL of a youtube video. To set a placeholder, preview thumbnail use `poster`, it even works nicely via GUI. In the end it should look somewhat like the bellow example.
```
[video src="https://www.youtube.com/watc... |
288,463 | <p>I asked a question yesterday, but I realised that the code was not correct and it was my bad, so I refactored everything. I have a form with two fields which when user submits and takes a quiz test, gets registered and his scores saved to user meta data table. My user gets created, but when I want to add extra meta ... | [
{
"answer_id": 288464,
"author": "Limpuls",
"author_id": 133005,
"author_profile": "https://wordpress.stackexchange.com/users/133005",
"pm_score": 2,
"selected": false,
"text": "<p>Solved the problem by changing these lines:</p>\n\n<pre><code>register_new_user($email, $_SESSION[\"email\"... | 2017/12/13 | [
"https://wordpress.stackexchange.com/questions/288463",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/133005/"
] | I asked a question yesterday, but I realised that the code was not correct and it was my bad, so I refactored everything. I have a form with two fields which when user submits and takes a quiz test, gets registered and his scores saved to user meta data table. My user gets created, but when I want to add extra meta dat... | You set the variable `$user` before you created this user..
It should be like this and you need to check if the user already exists
```
$user = get_user_by("email", $email); // Its return you the user object
if($user) {
update_user_meta($user->ID, "quiz_scores", $score);
} else {
$user_id = register_new_user(... |
288,486 | <p>I want to display 4 column footer menu. but when I add new menu the wp_nav_menu create a < li > and add every menu items to it.</p>
<p><a href="https://i.stack.imgur.com/Fw6do.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Fw6do.png" alt="enter image description here"></a></p>
<p>now, how ca... | [
{
"answer_id": 288464,
"author": "Limpuls",
"author_id": 133005,
"author_profile": "https://wordpress.stackexchange.com/users/133005",
"pm_score": 2,
"selected": false,
"text": "<p>Solved the problem by changing these lines:</p>\n\n<pre><code>register_new_user($email, $_SESSION[\"email\"... | 2017/12/13 | [
"https://wordpress.stackexchange.com/questions/288486",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/133193/"
] | I want to display 4 column footer menu. but when I add new menu the wp\_nav\_menu create a < li > and add every menu items to it.
[](https://i.stack.imgur.com/Fw6do.png)
now, how can I wrap every li element with a custom div tag with a class?
I need... | You set the variable `$user` before you created this user..
It should be like this and you need to check if the user already exists
```
$user = get_user_by("email", $email); // Its return you the user object
if($user) {
update_user_meta($user->ID, "quiz_scores", $score);
} else {
$user_id = register_new_user(... |
288,496 | <p>I want to force all user to access https (SSL) entire website.
I tried to set it at options-general.php page,I try to install a plug-in.
They are all success.But I can't enter or access all wp-admin page either.
The website will redirect to myaccount page when force to SSL is on.</p>
<p>how can i access admin page ... | [
{
"answer_id": 288464,
"author": "Limpuls",
"author_id": 133005,
"author_profile": "https://wordpress.stackexchange.com/users/133005",
"pm_score": 2,
"selected": false,
"text": "<p>Solved the problem by changing these lines:</p>\n\n<pre><code>register_new_user($email, $_SESSION[\"email\"... | 2017/12/13 | [
"https://wordpress.stackexchange.com/questions/288496",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/133200/"
] | I want to force all user to access https (SSL) entire website.
I tried to set it at options-general.php page,I try to install a plug-in.
They are all success.But I can't enter or access all wp-admin page either.
The website will redirect to myaccount page when force to SSL is on.
how can i access admin page with ssl? ... | You set the variable `$user` before you created this user..
It should be like this and you need to check if the user already exists
```
$user = get_user_by("email", $email); // Its return you the user object
if($user) {
update_user_meta($user->ID, "quiz_scores", $score);
} else {
$user_id = register_new_user(... |
288,504 | <p>Is it possible to rewrite this kind of action url on all the posts of a custom post type?</p>
<p><strong>Original url:</strong></p>
<pre><code>example.com/custompostype/post-title/?action=play-123
</code></pre>
<p>(Desired Output) <strong>Rewriting to:</strong></p>
<pre><code>example.com/custompostype/post-title... | [
{
"answer_id": 288505,
"author": "Sid",
"author_id": 110516,
"author_profile": "https://wordpress.stackexchange.com/users/110516",
"pm_score": -1,
"selected": false,
"text": "<p>Assuming that you have the page (new URL) already functional, use this:</p>\n\n<pre><code>$current_url=\"//\".... | 2017/12/13 | [
"https://wordpress.stackexchange.com/questions/288504",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/133205/"
] | Is it possible to rewrite this kind of action url on all the posts of a custom post type?
**Original url:**
```
example.com/custompostype/post-title/?action=play-123
```
(Desired Output) **Rewriting to:**
```
example.com/custompostype/post-title/play-123
```
123 = **postid**
Is it possible to do it with wordpre... | I just realized i used different kind of rewriting which didn't require @Jacob's codes (using add\_rewrite\_endpoint)
```
add_action('init', 'wpse42279_add_endpoints');
function wpse42279_add_endpoints()
{
add_rewrite_endpoint('play', EP_PERMALINK);
}
```
And then i used this conditionals on the single page:
``... |
288,530 | <p>All in <em>single.php</em> file in <em>Genesis child theme</em>.</p>
<p>I have an <code>echo</code> of <code>divs</code> and in between I in one of the <code>anchors</code> I am trying to insert author's post url via a <code>variable</code>, like so:</p>
<pre><code>function my_function() {
$author = get_th... | [
{
"answer_id": 288505,
"author": "Sid",
"author_id": 110516,
"author_profile": "https://wordpress.stackexchange.com/users/110516",
"pm_score": -1,
"selected": false,
"text": "<p>Assuming that you have the page (new URL) already functional, use this:</p>\n\n<pre><code>$current_url=\"//\".... | 2017/12/13 | [
"https://wordpress.stackexchange.com/questions/288530",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/103078/"
] | All in *single.php* file in *Genesis child theme*.
I have an `echo` of `divs` and in between I in one of the `anchors` I am trying to insert author's post url via a `variable`, like so:
```
function my_function() {
$author = get_the_author_meta( $post->post_author );
$author_link = get_author_posts_url($a... | I just realized i used different kind of rewriting which didn't require @Jacob's codes (using add\_rewrite\_endpoint)
```
add_action('init', 'wpse42279_add_endpoints');
function wpse42279_add_endpoints()
{
add_rewrite_endpoint('play', EP_PERMALINK);
}
```
And then i used this conditionals on the single page:
``... |
288,538 | <p>The problem is simple, the solution doesn't want to meet me. I want to display (echo) the percentage of the VAT I have defined in my woocommerce settings. Let's say it is 24%. I want to echo it (in the cart or checkout page somewhere, it doesn't really matter) as 0.24 . If I change the VAT to 22%, then automatically... | [
{
"answer_id": 288505,
"author": "Sid",
"author_id": 110516,
"author_profile": "https://wordpress.stackexchange.com/users/110516",
"pm_score": -1,
"selected": false,
"text": "<p>Assuming that you have the page (new URL) already functional, use this:</p>\n\n<pre><code>$current_url=\"//\".... | 2017/12/13 | [
"https://wordpress.stackexchange.com/questions/288538",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/80225/"
] | The problem is simple, the solution doesn't want to meet me. I want to display (echo) the percentage of the VAT I have defined in my woocommerce settings. Let's say it is 24%. I want to echo it (in the cart or checkout page somewhere, it doesn't really matter) as 0.24 . If I change the VAT to 22%, then automatically it... | I just realized i used different kind of rewriting which didn't require @Jacob's codes (using add\_rewrite\_endpoint)
```
add_action('init', 'wpse42279_add_endpoints');
function wpse42279_add_endpoints()
{
add_rewrite_endpoint('play', EP_PERMALINK);
}
```
And then i used this conditionals on the single page:
``... |
288,540 | <p>I am creating a membership site where I am trying to login a particular user from a link sent to their email address.</p>
<p>I have a custom post typed called "Members", where I have stored a unique key with the name "user_key". After a particular process, the email is sent to that user with an auto login link.</p>... | [
{
"answer_id": 288505,
"author": "Sid",
"author_id": 110516,
"author_profile": "https://wordpress.stackexchange.com/users/110516",
"pm_score": -1,
"selected": false,
"text": "<p>Assuming that you have the page (new URL) already functional, use this:</p>\n\n<pre><code>$current_url=\"//\".... | 2017/12/13 | [
"https://wordpress.stackexchange.com/questions/288540",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/30753/"
] | I am creating a membership site where I am trying to login a particular user from a link sent to their email address.
I have a custom post typed called "Members", where I have stored a unique key with the name "user\_key". After a particular process, the email is sent to that user with an auto login link.
An example ... | I just realized i used different kind of rewriting which didn't require @Jacob's codes (using add\_rewrite\_endpoint)
```
add_action('init', 'wpse42279_add_endpoints');
function wpse42279_add_endpoints()
{
add_rewrite_endpoint('play', EP_PERMALINK);
}
```
And then i used this conditionals on the single page:
``... |
288,564 | <p>I need to include jquery in a single page template of my theme. But it looks like it doesn't want to.</p>
<p>I tried calling it with wp_enqueue_scripts() but i does nothing.
Here is what is in functions.php</p>
<pre><code>add_action( 'wp_enqueue_scripts', 'custom_theme_load_scripts' );
function custom_theme_load_s... | [
{
"answer_id": 288572,
"author": "dipak_pusti",
"author_id": 44528,
"author_profile": "https://wordpress.stackexchange.com/users/44528",
"pm_score": 0,
"selected": false,
"text": "<p>What you are trying to do in <code>page-template.php</code> is totally wrong. Try to run conditional quer... | 2017/12/14 | [
"https://wordpress.stackexchange.com/questions/288564",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/132140/"
] | I need to include jquery in a single page template of my theme. But it looks like it doesn't want to.
I tried calling it with wp\_enqueue\_scripts() but i does nothing.
Here is what is in functions.php
```
add_action( 'wp_enqueue_scripts', 'custom_theme_load_scripts' );
function custom_theme_load_scripts()
{
wp_enque... | Okay, this is awkward but I resolved my own issue.
jQuery was indeed charging but... I was using `$this`.
And as someone already said on another thread:
>
> By default when you enqueue jQuery in Wordpress you must use jQuery, and $ is not used (this is for compatibility with other libraries).
>
>
>
So, you must ... |
288,581 | <p>Issue URL - <a href="http://www.creativescripters.com/clients/testwp/uncategorized/image-resized/" rel="nofollow noreferrer">http://www.creativescripters.com/clients/testwp/uncategorized/image-resized/</a></p>
<p>I am using wordpress (self hosted) latest version, The problem is I am looking to get a thumbnail from ... | [
{
"answer_id": 288584,
"author": "Tarang koradiya",
"author_id": 128666,
"author_profile": "https://wordpress.stackexchange.com/users/128666",
"pm_score": 2,
"selected": false,
"text": "<p>Used img tag and display image</p>\n\n<pre><code><img src=\"<?= $img_url=get_the_post_thumbna... | 2017/12/14 | [
"https://wordpress.stackexchange.com/questions/288581",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/10639/"
] | Issue URL - <http://www.creativescripters.com/clients/testwp/uncategorized/image-resized/>
I am using wordpress (self hosted) latest version, The problem is I am looking to get a thumbnail from the resized/scaled image, and when I do that wordpress returns the test-150x150.jpg i.e. Thumbnail from the original image an... | Used img tag and display image
```
<img src="<?= $img_url=get_the_post_thumbnail_url($post->ID,'full'); ?>" alt="image" />
``` |
288,595 | <p>I'm trying to create some custom REST API endpoints which get products with some special conditions, for example, one endpoint for featured products.
I tried to use the <code>wc_get_products</code> function like this:</p>
<pre><code>add_action('rest_api_init', 'my_custom_featured_product_endpoint');
function my_cu... | [
{
"answer_id": 307143,
"author": "Brauperle",
"author_id": 145985,
"author_profile": "https://wordpress.stackexchange.com/users/145985",
"pm_score": 0,
"selected": false,
"text": "<p>I faced a similar behavior where <code>$wc_get_product</code> always returned empty objects from a custom... | 2017/12/14 | [
"https://wordpress.stackexchange.com/questions/288595",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/133259/"
] | I'm trying to create some custom REST API endpoints which get products with some special conditions, for example, one endpoint for featured products.
I tried to use the `wc_get_products` function like this:
```
add_action('rest_api_init', 'my_custom_featured_product_endpoint');
function my_custom_featured_product_end... | you missed something, when you get a product using wc\_get\_product it returns to you an abstract object, so if you need to get product do this
```
$product = wc_get_product($product_id);
return $product->get_data();
```
also you can use all the other functionalities too, such as:
```
$product->get_status();
$prod... |
288,650 | <p>I have a front-end form posting to admin_post. Here, I do some validation. If there are errors, I want to show an error message for the relevant fields.</p>
<p>However, I don't know how to redirect back to the submission page and retain the field values.</p>
<p>Currently I'm using the below:.</p>
<pre><code>add_a... | [
{
"answer_id": 295462,
"author": "Kevin Robinson",
"author_id": 133315,
"author_profile": "https://wordpress.stackexchange.com/users/133315",
"pm_score": 0,
"selected": false,
"text": "<p>I solved this using the $_SESSION variable to pass data to the following page.</p>\n\n<pre><code> i... | 2017/12/14 | [
"https://wordpress.stackexchange.com/questions/288650",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/133315/"
] | I have a front-end form posting to admin\_post. Here, I do some validation. If there are errors, I want to show an error message for the relevant fields.
However, I don't know how to redirect back to the submission page and retain the field values.
Currently I'm using the below:.
```
add_action( 'admin_post_form', '... | You can use `set_transient` with the `user_id` if you are relying on users being logged in, otherwise, cookie would probably be better. For logged in users, you can have the `user_id` get set within the name of the transient. An example here:
```
function form_post() {
$user_info = wp_get_current_user();
$user... |
288,655 | <p>On my search.php page, I have a "Sort By" dropdown that almost works exactly how I want it to --</p>
<pre><code><select class="dropdown-class" name="sort-posts" id="sortbox" onchange="document.location.href=location.href+this.options[this.selectedIndex].value;">
<option disabled>Sort by</option>
&... | [
{
"answer_id": 289693,
"author": "Nicolai Grossherr",
"author_id": 22534,
"author_profile": "https://wordpress.stackexchange.com/users/22534",
"pm_score": 1,
"selected": false,
"text": "<p><code>orderby</code> should be e.g. <code>meta_value</code> or <code>meta_value_num</code> – variou... | 2017/12/14 | [
"https://wordpress.stackexchange.com/questions/288655",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/24067/"
] | On my search.php page, I have a "Sort By" dropdown that almost works exactly how I want it to --
```
<select class="dropdown-class" name="sort-posts" id="sortbox" onchange="document.location.href=location.href+this.options[this.selectedIndex].value;">
<option disabled>Sort by</option>
<option value="&orderby=date&orde... | Ok I got it figured out using @Nicolai suggestion and also a answer from another question (which I seem to have lost the link to).
For starters, I had to make sure my numbers have no commas in it which I had already done by saving my post meta without it.
Then the code I found in another question, I used and placed i... |
288,740 | <p>In my addon, I would like to check on activation, if a column of a specific table in the DB already exists to avoid to implement it for each activation.</p>
<p>Something like this :</p>
<pre><code>class MainClassAddon{
public function __construct(){
register_activation_hook( __FILE__, array( $this, ... | [
{
"answer_id": 288741,
"author": "J.BizMai",
"author_id": 128094,
"author_profile": "https://wordpress.stackexchange.com/users/128094",
"pm_score": 2,
"selected": true,
"text": "<p>I found this solution : <a href=\"https://stackoverflow.com/questions/21330932/add-new-column-to-wordpress-... | 2017/12/15 | [
"https://wordpress.stackexchange.com/questions/288740",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/128094/"
] | In my addon, I would like to check on activation, if a column of a specific table in the DB already exists to avoid to implement it for each activation.
Something like this :
```
class MainClassAddon{
public function __construct(){
register_activation_hook( __FILE__, array( $this, 'install' ) );
}... | I found this solution : [here](https://stackoverflow.com/questions/21330932/add-new-column-to-wordpress-database#answer-21331762)
So...
```
class MainClassAddon{
public function __construct(){
register_activation_hook( __FILE__, array( $this, 'install' ) );
}
public function install(){
... |
288,769 | <p>My client explicitly does not want to use 'multisite' wordpress option. <br>
My client has a main site and 199 sub sites (other domains). <br>
A user has usermeta with meta key: branch_id <br></p>
<p>As an example (completely made up names): <br>
Main site: kero.com <br>
Sub site: uka.com (and many others) <br></p>... | [
{
"answer_id": 288808,
"author": "Mark Kaplun",
"author_id": 23970,
"author_profile": "https://wordpress.stackexchange.com/users/23970",
"pm_score": 1,
"selected": false,
"text": "<p>You can not set cookies form site A that will be applicable on site B, therefor your \"login by proxy\" s... | 2017/12/16 | [
"https://wordpress.stackexchange.com/questions/288769",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/131414/"
] | My client explicitly does not want to use 'multisite' wordpress option.
My client has a main site and 199 sub sites (other domains).
A user has usermeta with meta key: branch\_id
As an example (completely made up names):
Main site: kero.com
Sub site: uka.com (and many others)
Both domains have S... | For future reference I am answering my own question.
Disclaimer: This was a freelance gig and had to be done in a X time frame.
Which mean that this was the quickest AND simplest option.
What I did was:
1. Installed the plugin <https://wordpress.org/plugins/user-session-synchronizer/> - Give this guy some credit, th... |
288,776 | <p>This is my array of image URL's added to the same custom field named images.</p>
<pre><code> $images = get_post_custom_values( 'images' );
</code></pre>
<p>I need to print all these images in a template file.</p>
| [
{
"answer_id": 288780,
"author": "Cyclonecode",
"author_id": 14870,
"author_profile": "https://wordpress.stackexchange.com/users/14870",
"pm_score": 2,
"selected": false,
"text": "<p>Since you are storing an url for each image you can create a query to get the id of the attachment based ... | 2017/12/16 | [
"https://wordpress.stackexchange.com/questions/288776",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/104464/"
] | This is my array of image URL's added to the same custom field named images.
```
$images = get_post_custom_values( 'images' );
```
I need to print all these images in a template file. | This is how i ended up coding the solution :
```
$images = get_post_custom_values( 'images' );
if ( $images ) {
echo '<div class="image-wrap">';
if ( $image_header ) {
echo '<div class="header">' . esc_html( $image_header ) . '</div>';
}
foreach ( (array) $images as $image ) {
$url... |
288,781 | <p>I am trying to debug a plugin and am using <code>error_log()</code> in various places to see what various things are. I am using the following:</p>
<pre><code>error_log( print_r( $variable ) );
</code></pre>
<p>When I look at <code>debug.log</code>, all I see is <code>1</code> and the actual output of the <code>er... | [
{
"answer_id": 288782,
"author": "Shibi",
"author_id": 62500,
"author_profile": "https://wordpress.stackexchange.com/users/62500",
"pm_score": 5,
"selected": true,
"text": "<p>The <a href=\"http://php.net/manual/en/function.print-r.php\" rel=\"noreferrer\">print_r</a> function accept sec... | 2017/12/16 | [
"https://wordpress.stackexchange.com/questions/288781",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/80069/"
] | I am trying to debug a plugin and am using `error_log()` in various places to see what various things are. I am using the following:
```
error_log( print_r( $variable ) );
```
When I look at `debug.log`, all I see is `1` and the actual output of the `error_log()` function is sent to the browser instead.
I know anot... | The [print\_r](http://php.net/manual/en/function.print-r.php) function accept second parameter for `return` so it retrun the variable instead of printing it.
```
print_r($expression, $return)
```
So you can do
```
error_log( print_r( $variable, true ) );
``` |
288,793 | <p>I making homepage in the local host.</p>
<p>I need <code>wp_query</code> with Ajax.</p>
<p>but there's some error. I don't know why. Can you help me?</p>
<p>----> this is <code>load_more_ajax.js</code></p>
<pre><code>var page = 2;
var date_pass = "<?php echo($date_filter);?>";
var compare_pass = "<?php ... | [
{
"answer_id": 288795,
"author": "janh",
"author_id": 129206,
"author_profile": "https://wordpress.stackexchange.com/users/129206",
"pm_score": 0,
"selected": false,
"text": "<p>You can't use PHP code in a .js file, unless you change your config. Even if you did, you'd also have to load ... | 2017/12/17 | [
"https://wordpress.stackexchange.com/questions/288793",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/133185/"
] | I making homepage in the local host.
I need `wp_query` with Ajax.
but there's some error. I don't know why. Can you help me?
----> this is `load_more_ajax.js`
```
var page = 2;
var date_pass = "<?php echo($date_filter);?>";
var compare_pass = "<?php echo($compare);?>";
var ajaxurl = "<?php echo admin_url( 'admin-aj... | You need to pass the values to the localization script, *"right"* after this line:
```
wp_enqueue_script('rnm_load_more');
```
I'm going to pass the admin URL to your script by using [`wp_localize_script`](https://codex.wordpress.org/Function_Reference/wp_localize_script):
```
$localization = array(
'ajax_url' ... |
288,804 | <p>I have a custom function in functions.php that excludes specific category from the category list:</p>
<pre><code>function incomplete_cat_list() {
$first_time = 1;
foreach((get_the_category()) as $category) {
if ($category->cat_name != 'Category Name') {
if ($first_time == 1) {
... | [
{
"answer_id": 288805,
"author": "Shibi",
"author_id": 62500,
"author_profile": "https://wordpress.stackexchange.com/users/62500",
"pm_score": 2,
"selected": true,
"text": "<p>First you need to pass the post_id to this function to use the post_id inside the <code>get_the_category($post_i... | 2017/12/17 | [
"https://wordpress.stackexchange.com/questions/288804",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/133403/"
] | I have a custom function in functions.php that excludes specific category from the category list:
```
function incomplete_cat_list() {
$first_time = 1;
foreach((get_the_category()) as $category) {
if ($category->cat_name != 'Category Name') {
if ($first_time == 1) {
echo '<a class... | First you need to pass the post\_id to this function to use the post\_id inside the `get_the_category($post_id)`
```
function incomplete_cat_list($post_id = '') {
global $post;
$post_id = ($post_id) ? $post_id : $post->ID;
$first_time = 1;
$categories = get_the_category($post_id);
foreach($categori... |
288,831 | <p>In my archive I have tipical loop</p>
<pre><code>if ( have_posts() ) :
/* Start the Loop */
while ( have_posts() ) : the_post();
get_template_part( 'template-parts/content', get_post_format() );
endwhile;
wp_reset_postdata();
else :
get_template_part( 'template-parts/content', 'none' );
e... | [
{
"answer_id": 288837,
"author": "WhirledPress",
"author_id": 133443,
"author_profile": "https://wordpress.stackexchange.com/users/133443",
"pm_score": 1,
"selected": false,
"text": "<p>I'm not entirely sure, but it looks like you need another conditional in your filter. Right now, it fi... | 2017/12/17 | [
"https://wordpress.stackexchange.com/questions/288831",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/48915/"
] | In my archive I have tipical loop
```
if ( have_posts() ) :
/* Start the Loop */
while ( have_posts() ) : the_post();
get_template_part( 'template-parts/content', get_post_format() );
endwhile;
wp_reset_postdata();
else :
get_template_part( 'template-parts/content', 'none' );
endif;
```
A... | I got this sorted, by adding additional contional statement and wrapped OR statements in brackets:
```
function mvp_add_custom_types( $query ) {
if( ( is_category() || is_tag() || is_date() ) && $query->is_main_query() && empty( $query->query_vars['suppress_filters'] ) ) {
$query->set( 'post_type', array(... |
288,854 | <p>I have this code:</p>
<pre><code>@font-face {
font-family: 'Miller Banner Light';
src: url('fonts/Miller-Banner-Light-01.eot'); /* IE9 Compat Modes */
src: url('fonts/Miller-Banner-Light-01.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('fonts/Miller-Banner-Light-01.woff') format('woff'... | [
{
"answer_id": 288837,
"author": "WhirledPress",
"author_id": 133443,
"author_profile": "https://wordpress.stackexchange.com/users/133443",
"pm_score": 1,
"selected": false,
"text": "<p>I'm not entirely sure, but it looks like you need another conditional in your filter. Right now, it fi... | 2017/12/18 | [
"https://wordpress.stackexchange.com/questions/288854",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/133461/"
] | I have this code:
```
@font-face {
font-family: 'Miller Banner Light';
src: url('fonts/Miller-Banner-Light-01.eot'); /* IE9 Compat Modes */
src: url('fonts/Miller-Banner-Light-01.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('fonts/Miller-Banner-Light-01.woff') format('woff'), /* Pretty M... | I got this sorted, by adding additional contional statement and wrapped OR statements in brackets:
```
function mvp_add_custom_types( $query ) {
if( ( is_category() || is_tag() || is_date() ) && $query->is_main_query() && empty( $query->query_vars['suppress_filters'] ) ) {
$query->set( 'post_type', array(... |
288,868 | <p>I'm trying to disable author's link when author's name is displayed. I don't want anything that links to the author archive. Just text without <code><a href></code>.</p>
<p>What template or file should I edit? I tried the theme template but couldn't find anything, maybe it's something related to the wp files ... | [
{
"answer_id": 288880,
"author": "Antonio",
"author_id": 78763,
"author_profile": "https://wordpress.stackexchange.com/users/78763",
"pm_score": 3,
"selected": true,
"text": "<p>You have actually two problems to solve here:</p>\n\n<ul>\n<li><p>The first one is to remove the HTML link, wh... | 2017/12/18 | [
"https://wordpress.stackexchange.com/questions/288868",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/89820/"
] | I'm trying to disable author's link when author's name is displayed. I don't want anything that links to the author archive. Just text without `<a href>`.
What template or file should I edit? I tried the theme template but couldn't find anything, maybe it's something related to the wp files | You have actually two problems to solve here:
* The first one is to remove the HTML link, which you are trying to achieve right now. As you read in the comments, it depends on your theme. You could find it looking for the exact HTML displayed around the author name (CSS classes etc), and then seeking for it in the fil... |
288,995 | <p>Using pure PHP code inside WordPress I am having trouble on getting the <code>glob()</code> work to generate image source.</p>
<pre><code><div class="carousel-inner" role="listbox" style="height=600px; width=1000px;">
<?php
$directory = "http://geocaa.com/wp-content/themes/Booting/img/services/";
... | [
{
"answer_id": 288996,
"author": "Elex",
"author_id": 113687,
"author_profile": "https://wordpress.stackexchange.com/users/113687",
"pm_score": 0,
"selected": false,
"text": "<p>I think you just have to try <code>get_stylesheet_directory()</code>.</p>\n\n<pre><code>$images = glob(get_sty... | 2017/12/19 | [
"https://wordpress.stackexchange.com/questions/288995",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/35444/"
] | Using pure PHP code inside WordPress I am having trouble on getting the `glob()` work to generate image source.
```
<div class="carousel-inner" role="listbox" style="height=600px; width=1000px;">
<?php
$directory = "http://geocaa.com/wp-content/themes/Booting/img/services/";
$images = glob($directory . "... | You should use *paths* with `glob`, not *URLs*.
But `src` attributes needs URLs.
So something like this should work:
```
$base_dir = trailingslashit(get_template_directory());
$dir = 'img/services/';
$images = glob($base_dir.$dir.'*.png');
foreach($images as $image) {
$url = get_theme_file_uri($dir.basen... |
288,998 | <p>I'm trying to use for the second time the hook wp_ajax to call a php method from a Class inside my js script. I did it one time with success but this time, it does not work. I don't know why.</p>
<p>Context : I do this in an addon, not in my main plugin.</p>
<p>I did all these following steps :</p>
<p><strong>Add... | [
{
"answer_id": 289002,
"author": "Anton Lukin",
"author_id": 126253,
"author_profile": "https://wordpress.stackexchange.com/users/126253",
"pm_score": 1,
"selected": false,
"text": "<p>Finally I've found the problem in your code.\nYou've forgotten \\ on namespace path.</p>\n\n<pre><code>... | 2017/12/19 | [
"https://wordpress.stackexchange.com/questions/288998",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/128094/"
] | I'm trying to use for the second time the hook wp\_ajax to call a php method from a Class inside my js script. I did it one time with success but this time, it does not work. I don't know why.
Context : I do this in an addon, not in my main plugin.
I did all these following steps :
**Add my function in my class *Foo... | After several tests, and some help inside the comments, I detect the right problem :
>
> if xhr response returns 0 means that the ajax function does not be hooked.
>
>
>
The solution in my case was to init my addon classes with a right hook like [here](https://wordpress.stackexchange.com/questions/289112/how-to-... |
289,048 | <p>While there may be another or better way to do it, all I need is this last snippet to make this do exactly what I need. So, I hope anyone here can and is willing to help me get it working as I need?</p>
<p>First, in the WP back-end I created and published a blank page (using a custom template) that is a required pa... | [
{
"answer_id": 289002,
"author": "Anton Lukin",
"author_id": 126253,
"author_profile": "https://wordpress.stackexchange.com/users/126253",
"pm_score": 1,
"selected": false,
"text": "<p>Finally I've found the problem in your code.\nYou've forgotten \\ on namespace path.</p>\n\n<pre><code>... | 2017/12/20 | [
"https://wordpress.stackexchange.com/questions/289048",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/58726/"
] | While there may be another or better way to do it, all I need is this last snippet to make this do exactly what I need. So, I hope anyone here can and is willing to help me get it working as I need?
First, in the WP back-end I created and published a blank page (using a custom template) that is a required part of this... | After several tests, and some help inside the comments, I detect the right problem :
>
> if xhr response returns 0 means that the ajax function does not be hooked.
>
>
>
The solution in my case was to init my addon classes with a right hook like [here](https://wordpress.stackexchange.com/questions/289112/how-to-... |
289,063 | <p>I've created some custom post-types using the Pods framework, however the the solution to my question should be the same regardless of pods. My custom types are <code>event</code>, <code>team</code>, <code>achievement</code>, <code>achievementunlock</code>. Each <code>team</code> and <code>achievement</code> belongs... | [
{
"answer_id": 289175,
"author": "Rajilesh Panoli",
"author_id": 68892,
"author_profile": "https://wordpress.stackexchange.com/users/68892",
"pm_score": 2,
"selected": false,
"text": "<p>It seems you are asking for a complete custom funcionality,</p>\n\n<p>To add menu, you can use this.<... | 2017/12/20 | [
"https://wordpress.stackexchange.com/questions/289063",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/133576/"
] | I've created some custom post-types using the Pods framework, however the the solution to my question should be the same regardless of pods. My custom types are `event`, `team`, `achievement`, `achievementunlock`. Each `team` and `achievement` belongs to an `event`, each `team` has a number of users assigned, and each ... | Although Rahilesh pointed me in the right direction and is upvoted for that, I feel that I can provide a more complete answer now that I've got things running.
First create a new PHP template file, create a page and connect it to that template and add the page to your menu.
In that file you can now query the wordpres... |
289,110 | <p>I'm using the Enigma theme in my webpage and I want to hide the title of some posts without using any plugins. Every tutorial I find on the internet teaches me how to do it in a incompatible way for my theme. The TAGs of the HTML and the CSS code aren't matching with the structure of mine.
So I need some help to do ... | [
{
"answer_id": 289175,
"author": "Rajilesh Panoli",
"author_id": 68892,
"author_profile": "https://wordpress.stackexchange.com/users/68892",
"pm_score": 2,
"selected": false,
"text": "<p>It seems you are asking for a complete custom funcionality,</p>\n\n<p>To add menu, you can use this.<... | 2017/12/20 | [
"https://wordpress.stackexchange.com/questions/289110",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/133600/"
] | I'm using the Enigma theme in my webpage and I want to hide the title of some posts without using any plugins. Every tutorial I find on the internet teaches me how to do it in a incompatible way for my theme. The TAGs of the HTML and the CSS code aren't matching with the structure of mine.
So I need some help to do it. | Although Rahilesh pointed me in the right direction and is upvoted for that, I feel that I can provide a more complete answer now that I've got things running.
First create a new PHP template file, create a page and connect it to that template and add the page to your menu.
In that file you can now query the wordpres... |
289,169 | <p>I want to create an A to Z index listing of all posts from a specific custom post type.
This is the code so far:</p>
<pre><code><?php
/**
* The Template for displaying archive series.
*
* Theme: Default
*/
get_header(); ?>
<div id="content">
<?php
$paged = (get_query_var('paged')) ? ge... | [
{
"answer_id": 289170,
"author": "Elex",
"author_id": 113687,
"author_profile": "https://wordpress.stackexchange.com/users/113687",
"pm_score": 4,
"selected": true,
"text": "<p>Ok, you just have to make a loop with first letter check. WordPress query will handle the <code>post_title</cod... | 2017/12/21 | [
"https://wordpress.stackexchange.com/questions/289169",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/100682/"
] | I want to create an A to Z index listing of all posts from a specific custom post type.
This is the code so far:
```
<?php
/**
* The Template for displaying archive series.
*
* Theme: Default
*/
get_header(); ?>
<div id="content">
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$ar... | Ok, you just have to make a loop with first letter check. WordPress query will handle the `post_title` `ASC` order.
**EDIT :** I use get\_permalink() within the loop to get URL (<https://developer.wordpress.org/reference/functions/get_permalink/>)
```
$series = new WP_Query(array(
'posts_per_page' => -1,
... |
289,258 | <p>I'm hoping someone can help as I have searched and cannot find an answer...</p>
<p>I am using a loop in a shortcode to display a list of related items and I'm having trouble working out the logic of selecting multiple categories in an AND parameter.</p>
<p>For example, I have a category structure like this:</p>
<... | [
{
"answer_id": 289239,
"author": "Gordon Smith",
"author_id": 73331,
"author_profile": "https://wordpress.stackexchange.com/users/73331",
"pm_score": 2,
"selected": false,
"text": "<p>To shorten your search the article points out that the suggested code is old and that you can now use th... | 2017/12/22 | [
"https://wordpress.stackexchange.com/questions/289258",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/133687/"
] | I'm hoping someone can help as I have searched and cannot find an answer...
I am using a loop in a shortcode to display a list of related items and I'm having trouble working out the logic of selecting multiple categories in an AND parameter.
For example, I have a category structure like this:
```
Products (id: 1)
... | To shorten your search the article points out that the suggested code is old and that you can now use this plug-in to define custom colors: [Central Color Palette](https://wordpress.org/plugins/kt-tinymce-color-grid/) |
289,269 | <p>I have create a custom meta key into the post table and it's value is in serialized form now when I dump the value it is giving me like this</p>
<blockquote>
<p>Array ( [0] => a:3:{s:10:"product_id";s:4:"2592";s:7:"user_id";i:41;i:0;a:1:{i:0;s:63:"a:3:{s:10:"product_id";s:4:"2592";s:7:"user_id";i:2;i:0;a:0:{}}";}... | [
{
"answer_id": 289264,
"author": "Jacob Peattie",
"author_id": 39152,
"author_profile": "https://wordpress.stackexchange.com/users/39152",
"pm_score": 1,
"selected": false,
"text": "<p>As stated in the <a href=\"https://make.wordpress.org/core/2017/10/13/account-security-improvements-in-... | 2017/12/22 | [
"https://wordpress.stackexchange.com/questions/289269",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/132946/"
] | I have create a custom meta key into the post table and it's value is in serialized form now when I dump the value it is giving me like this
>
> Array ( [0] => a:3:{s:10:"product\_id";s:4:"2592";s:7:"user\_id";i:41;i:0;a:1:{i:0;s:63:"a:3:{s:10:"product\_id";s:4:"2592";s:7:"user\_id";i:2;i:0;a:0:{}}";}} )
>
>
>
I ... | As stated in the [announcement post](https://make.wordpress.org/core/2017/10/13/account-security-improvements-in-wordpress-4-9/):
>
> A few account security enhancements have gone into WordPress 4.9. The
> intention is to make it more difficult for an attacker to take over a
> user account or a site by changing the... |
289,281 | <p>I'm working on a relationship filter using <a href="https://www.advancedcustomfields.com/resources/acf-fields-relationship-query/" rel="nofollow noreferrer">this documentary</a>.</p>
<p>I made so far but can't make my return value. Normally in a custom Template I just echo it, but it's different in a function I thi... | [
{
"answer_id": 289264,
"author": "Jacob Peattie",
"author_id": 39152,
"author_profile": "https://wordpress.stackexchange.com/users/39152",
"pm_score": 1,
"selected": false,
"text": "<p>As stated in the <a href=\"https://make.wordpress.org/core/2017/10/13/account-security-improvements-in-... | 2017/12/22 | [
"https://wordpress.stackexchange.com/questions/289281",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/133469/"
] | I'm working on a relationship filter using [this documentary](https://www.advancedcustomfields.com/resources/acf-fields-relationship-query/).
I made so far but can't make my return value. Normally in a custom Template I just echo it, but it's different in a function I think.
```
function soup_filter( $args, $field, $... | As stated in the [announcement post](https://make.wordpress.org/core/2017/10/13/account-security-improvements-in-wordpress-4-9/):
>
> A few account security enhancements have gone into WordPress 4.9. The
> intention is to make it more difficult for an attacker to take over a
> user account or a site by changing the... |
289,287 | <p><code>ABSPATH</code> outputs like <code>C/:docs/http_root/public_html/</code> or <code>/home/userXXXXX/public_html</code> (or etc, depending on server).</p>
<p>However, I want to get the file location according to its relative path from <code>ABSPATH</code>. How to achieve that?</p>
<p>i.e. I want to get from fi... | [
{
"answer_id": 289264,
"author": "Jacob Peattie",
"author_id": 39152,
"author_profile": "https://wordpress.stackexchange.com/users/39152",
"pm_score": 1,
"selected": false,
"text": "<p>As stated in the <a href=\"https://make.wordpress.org/core/2017/10/13/account-security-improvements-in-... | 2017/12/22 | [
"https://wordpress.stackexchange.com/questions/289287",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/33667/"
] | `ABSPATH` outputs like `C/:docs/http_root/public_html/` or `/home/userXXXXX/public_html` (or etc, depending on server).
However, I want to get the file location according to its relative path from `ABSPATH`. How to achieve that?
i.e. I want to get from file:
```
C/:docs/http_root/public_html/some_folder/file.php
---... | As stated in the [announcement post](https://make.wordpress.org/core/2017/10/13/account-security-improvements-in-wordpress-4-9/):
>
> A few account security enhancements have gone into WordPress 4.9. The
> intention is to make it more difficult for an attacker to take over a
> user account or a site by changing the... |
289,293 | <p>I have manually created a role called "event-planner". I've assigned some capabilities to it and it works as expected. However, if I later set one of the capabilities from true to false (or vice versa), changes won't reflect on WordPress. I think this is related to WordPress not updating the capabilities b... | [
{
"answer_id": 289294,
"author": "HU is Sebastian",
"author_id": 56587,
"author_profile": "https://wordpress.stackexchange.com/users/56587",
"pm_score": 2,
"selected": false,
"text": "<p>You can use the function <a href=\"https://codex.wordpress.org/Function_Reference/add_cap\" rel=\"nof... | 2017/12/22 | [
"https://wordpress.stackexchange.com/questions/289293",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/21245/"
] | I have manually created a role called "event-planner". I've assigned some capabilities to it and it works as expected. However, if I later set one of the capabilities from true to false (or vice versa), changes won't reflect on WordPress. I think this is related to WordPress not updating the capabilities because if I d... | `add_role()` will not do anything if the role already exists, so it can't be used to modify capabilities. To modify capabilities use the `add_cap()` and `remove_cap()` method of the `WP_Role` object. You can get a `WP_Role` for your role using `get_role()`:
```
$role = get_role( 'event-planner' );
$role->add_cap( 'edi... |
289,307 | <p>I'm using <a href="https://www.themepunch.com/essgrid-doc/essential-grid-documentation/" rel="nofollow noreferrer">Essential Grid</a> plugin to create a custom meta field for posts. I've created a simple image field. The plan is to add the URL of the featured image. Problem is I'm not sure how to get the physical UR... | [
{
"answer_id": 289309,
"author": "Johansson",
"author_id": 94498,
"author_profile": "https://wordpress.stackexchange.com/users/94498",
"pm_score": 0,
"selected": false,
"text": "<p>If you are trying to retrieve the post's featured image URI, you can use the <a href=\"https://developer.wo... | 2017/12/22 | [
"https://wordpress.stackexchange.com/questions/289307",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/60386/"
] | I'm using [Essential Grid](https://www.themepunch.com/essgrid-doc/essential-grid-documentation/) plugin to create a custom meta field for posts. I've created a simple image field. The plan is to add the URL of the featured image. Problem is I'm not sure how to get the physical URL.
For instance, I'm trying to get `/my... | The function to use would be:
```
$url = get_the_post_thumbnail_url();
```
However, that's not the most helpful for you right now, so we have a meta field with placeholders that you need to swap out for URLs before outputting.
breaking that down we get these smaller steps:
```
// grab the field
// grab the URL
// ... |
289,321 | <p>I tried to make a child theme to change some colors. I used this <a href="https://codex.wordpress.org/Child_Themes" rel="nofollow noreferrer">https://codex.wordpress.org/Child_Themes</a> tutorial, but I still can't get this done. The problem is that I am not able to override some styles, because my stylesheet called... | [
{
"answer_id": 289322,
"author": "Tom J Nowell",
"author_id": 736,
"author_profile": "https://wordpress.stackexchange.com/users/736",
"pm_score": 3,
"selected": true,
"text": "<h2>Parent vs Child Themes</h2>\n\n<p><code>get_template_directory_uri</code> always refers to the parent theme ... | 2017/12/22 | [
"https://wordpress.stackexchange.com/questions/289321",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/133727/"
] | I tried to make a child theme to change some colors. I used this <https://codex.wordpress.org/Child_Themes> tutorial, but I still can't get this done. The problem is that I am not able to override some styles, because my stylesheet called "bootstrap.css" is not getting loaded.
My functions.php file looks like this
```... | Parent vs Child Themes
----------------------
`get_template_directory_uri` always refers to the parent theme you can verify this as you always should when things don't load as expected by looking in the console in the browsers dev tools. These would show 404 errors for the CSS files, in the wrong folder.
Instead, use... |
289,342 | <p>Where in the database can I find that a product is marked "featured"?
I have marked 4 products as featured but I have yet to find out how to retrieve this information from any the database tables.</p>
<p>Thank you.</p>
| [
{
"answer_id": 289322,
"author": "Tom J Nowell",
"author_id": 736,
"author_profile": "https://wordpress.stackexchange.com/users/736",
"pm_score": 3,
"selected": true,
"text": "<h2>Parent vs Child Themes</h2>\n\n<p><code>get_template_directory_uri</code> always refers to the parent theme ... | 2017/12/23 | [
"https://wordpress.stackexchange.com/questions/289342",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/131388/"
] | Where in the database can I find that a product is marked "featured"?
I have marked 4 products as featured but I have yet to find out how to retrieve this information from any the database tables.
Thank you. | Parent vs Child Themes
----------------------
`get_template_directory_uri` always refers to the parent theme you can verify this as you always should when things don't load as expected by looking in the console in the browsers dev tools. These would show 404 errors for the CSS files, in the wrong folder.
Instead, use... |
289,349 | <p>Is there a way to globally change the font size for Heading 1, Heading 2, Heading 3, etc.
So, for example, if I want to change the font size for everything tagged with H2, every H2 text size on every page in the site changes.</p>
<p>Thank you.</p>
| [
{
"answer_id": 289356,
"author": "Arsalan Mithani",
"author_id": 111402,
"author_profile": "https://wordpress.stackexchange.com/users/111402",
"pm_score": 1,
"selected": false,
"text": "<p>Depends on the theme you are using, some themes have general settings panel labelled as <strong>The... | 2017/12/23 | [
"https://wordpress.stackexchange.com/questions/289349",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/132968/"
] | Is there a way to globally change the font size for Heading 1, Heading 2, Heading 3, etc.
So, for example, if I want to change the font size for everything tagged with H2, every H2 text size on every page in the site changes.
Thank you. | Sure, locate the style.css file within your theme and paste the code below. I suggest using percentages in your declarations so as to keep the base size styling hopefully already in your theme.
```
h1 { font-size: 150%; }
h2 { font-size: 140%; }
h3 { font-size: 130%; }
h4 { font-size: 120%; }
h5 { font-size: 110%; }
... |
289,387 | <p>how can I remove default pagination on woocommerce shop page ?
and then use my custom pagination (or use pagination plugin) on woocommerce shop page</p>
<p>thank you</p>
| [
{
"answer_id": 289565,
"author": "D. Dan",
"author_id": 133528,
"author_profile": "https://wordpress.stackexchange.com/users/133528",
"pm_score": 2,
"selected": false,
"text": "<p>You need to locate the right file in the plugins/woocommerce/templates directory and make a woocommerce dire... | 2017/12/24 | [
"https://wordpress.stackexchange.com/questions/289387",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/131388/"
] | how can I remove default pagination on woocommerce shop page ?
and then use my custom pagination (or use pagination plugin) on woocommerce shop page
thank you | I found the answer :
1) remove woocommerce pagination in theme functions.php :
```
remove_action( 'woocommerce_before_shop_loop', 'storefront_woocommerce_pagination', 30 );
```
[storefront woocommerce template hooks](https://github.com/woocommerce/storefront/blob/8c510114a14f622e2219178a47c7da6d11556cb7/inc/woocomm... |
289,399 | <p>hi i need your help regarding for woo-commerce product title based search
we have list of product my searching keyword available in product title need to show list product. if product title don't have my search keyword but available in product description section this don't need to display this product. </p>
| [
{
"answer_id": 289565,
"author": "D. Dan",
"author_id": 133528,
"author_profile": "https://wordpress.stackexchange.com/users/133528",
"pm_score": 2,
"selected": false,
"text": "<p>You need to locate the right file in the plugins/woocommerce/templates directory and make a woocommerce dire... | 2017/12/24 | [
"https://wordpress.stackexchange.com/questions/289399",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/114102/"
] | hi i need your help regarding for woo-commerce product title based search
we have list of product my searching keyword available in product title need to show list product. if product title don't have my search keyword but available in product description section this don't need to display this product. | I found the answer :
1) remove woocommerce pagination in theme functions.php :
```
remove_action( 'woocommerce_before_shop_loop', 'storefront_woocommerce_pagination', 30 );
```
[storefront woocommerce template hooks](https://github.com/woocommerce/storefront/blob/8c510114a14f622e2219178a47c7da6d11556cb7/inc/woocomm... |
289,421 | <p>While writing a custom element for WC Bakery (formerly Visual Composer) I've discovered that the HTML tags are being stripped from the <code>textfield</code> parameter type. It's sanitizing the <code>textfield</code> value by default. </p>
<p>I could not find a way to disable the <code>textfield</code> sanitization... | [
{
"answer_id": 315493,
"author": "rtpHarry",
"author_id": 60500,
"author_profile": "https://wordpress.stackexchange.com/users/60500",
"pm_score": 2,
"selected": false,
"text": "<p>You need to change the type from <code>textarea</code> to <code>textarea_raw_html</code>:</p>\n\n<ul>\n<li><... | 2017/12/25 | [
"https://wordpress.stackexchange.com/questions/289421",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/75264/"
] | While writing a custom element for WC Bakery (formerly Visual Composer) I've discovered that the HTML tags are being stripped from the `textfield` parameter type. It's sanitizing the `textfield` value by default.
I could not find a way to disable the `textfield` sanitization.
How can I allow HTML tags to be entered... | You need to change the type from `textarea` to `textarea_raw_html`:
* <https://kb.wpbakery.com/docs/inner-api/vc_map/>
Under the section "Available type values" it says:
>
> textarea\_raw\_html: Text area, its content will be coded into base64 (this allows you to store raw js or raw html code)
>
>
>
Although I'... |
289,435 | <p>I'd like to move all my assets (CSS, JS, Images, Fonts) in an asset folder in my theme.</p>
<p>I did it very well for the fonts and images. For the CSS, I just kept the style.css with the style meta information in it (as advised <a href="https://wordpress.stackexchange.com/a/111505/133812">here</a>).</p>
<p>But I'... | [
{
"answer_id": 289441,
"author": "Serkan Algur",
"author_id": 23042,
"author_profile": "https://wordpress.stackexchange.com/users/23042",
"pm_score": 2,
"selected": true,
"text": "<p>go to your themes <code>functions.php</code> and find line 122. You will find navigation.js function.</p>... | 2017/12/25 | [
"https://wordpress.stackexchange.com/questions/289435",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/133812/"
] | I'd like to move all my assets (CSS, JS, Images, Fonts) in an asset folder in my theme.
I did it very well for the fonts and images. For the CSS, I just kept the style.css with the style meta information in it (as advised [here](https://wordpress.stackexchange.com/a/111505/133812)).
But I'm using the great underscore... | go to your themes `functions.php` and find line 122. You will find navigation.js function.
```
get_template_directory_uri() . '/js/navigation.js
```
and change it to
```
get_template_directory_uri() . 'assets/js/navigation.js
```
do it again for `skip-link-focus-fix.js` code located on line 124.
For customizer g... |
289,462 | <p>So i came to three posible solutions to this question and can't decide which is better. What is your opinion?</p>
<p>First solution:</p>
<pre><code>if ( ( in_array('administrator', userdata('role')) || in_array('editor',
userdata('role')) ) == false)
{
add_filter('show_admin_bar', '__return_false');
}
</code><... | [
{
"answer_id": 289441,
"author": "Serkan Algur",
"author_id": 23042,
"author_profile": "https://wordpress.stackexchange.com/users/23042",
"pm_score": 2,
"selected": true,
"text": "<p>go to your themes <code>functions.php</code> and find line 122. You will find navigation.js function.</p>... | 2017/12/25 | [
"https://wordpress.stackexchange.com/questions/289462",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/133829/"
] | So i came to three posible solutions to this question and can't decide which is better. What is your opinion?
First solution:
```
if ( ( in_array('administrator', userdata('role')) || in_array('editor',
userdata('role')) ) == false)
{
add_filter('show_admin_bar', '__return_false');
}
```
Second one:
```
if( ( ... | go to your themes `functions.php` and find line 122. You will find navigation.js function.
```
get_template_directory_uri() . '/js/navigation.js
```
and change it to
```
get_template_directory_uri() . 'assets/js/navigation.js
```
do it again for `skip-link-focus-fix.js` code located on line 124.
For customizer g... |
289,474 | <p>Whenever I post a new post or page, the website serves a 301 redirect to the homepage. All existing posts are working correctly (not redirecting). </p>
<p>What I've tried:<br>
- Checked console and confirm APACHE is serving 301<br>
- Tried to re-save permalinks from Wordpress<br>
- Checked .htaccess for anything o... | [
{
"answer_id": 289441,
"author": "Serkan Algur",
"author_id": 23042,
"author_profile": "https://wordpress.stackexchange.com/users/23042",
"pm_score": 2,
"selected": true,
"text": "<p>go to your themes <code>functions.php</code> and find line 122. You will find navigation.js function.</p>... | 2017/12/26 | [
"https://wordpress.stackexchange.com/questions/289474",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/133834/"
] | Whenever I post a new post or page, the website serves a 301 redirect to the homepage. All existing posts are working correctly (not redirecting).
What I've tried:
- Checked console and confirm APACHE is serving 301
- Tried to re-save permalinks from Wordpress
- Checked .htaccess for anything out of the ordi... | go to your themes `functions.php` and find line 122. You will find navigation.js function.
```
get_template_directory_uri() . '/js/navigation.js
```
and change it to
```
get_template_directory_uri() . 'assets/js/navigation.js
```
do it again for `skip-link-focus-fix.js` code located on line 124.
For customizer g... |
289,516 | <p>I need to add a bus timings category for a client.</p>
<p>I need to have </p>
<p>FROM STOP (selectable field)
TO STOP (selectable field)
START HOUR (selectable field but optional)
END HOUR (selectable field but optional)</p>
<p>take these inputs and show results with running buses in table within those times.</... | [
{
"answer_id": 289441,
"author": "Serkan Algur",
"author_id": 23042,
"author_profile": "https://wordpress.stackexchange.com/users/23042",
"pm_score": 2,
"selected": true,
"text": "<p>go to your themes <code>functions.php</code> and find line 122. You will find navigation.js function.</p>... | 2017/12/26 | [
"https://wordpress.stackexchange.com/questions/289516",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/133860/"
] | I need to add a bus timings category for a client.
I need to have
FROM STOP (selectable field)
TO STOP (selectable field)
START HOUR (selectable field but optional)
END HOUR (selectable field but optional)
take these inputs and show results with running buses in table within those times.
similar to this one
stac... | go to your themes `functions.php` and find line 122. You will find navigation.js function.
```
get_template_directory_uri() . '/js/navigation.js
```
and change it to
```
get_template_directory_uri() . 'assets/js/navigation.js
```
do it again for `skip-link-focus-fix.js` code located on line 124.
For customizer g... |
289,520 | <p>I am tasked with updating plugins and core on a number of blogs that I am completely unfamiliar with (nothing weird about them, but I haven't worked with them before today). </p>
<p>What I need to do is update all the plugins and the core, and after it's done fix or rollback any introduced bugs. Thing is, I don't... | [
{
"answer_id": 289441,
"author": "Serkan Algur",
"author_id": 23042,
"author_profile": "https://wordpress.stackexchange.com/users/23042",
"pm_score": 2,
"selected": true,
"text": "<p>go to your themes <code>functions.php</code> and find line 122. You will find navigation.js function.</p>... | 2017/12/26 | [
"https://wordpress.stackexchange.com/questions/289520",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/65569/"
] | I am tasked with updating plugins and core on a number of blogs that I am completely unfamiliar with (nothing weird about them, but I haven't worked with them before today).
What I need to do is update all the plugins and the core, and after it's done fix or rollback any introduced bugs. Thing is, I don't have shell ... | go to your themes `functions.php` and find line 122. You will find navigation.js function.
```
get_template_directory_uri() . '/js/navigation.js
```
and change it to
```
get_template_directory_uri() . 'assets/js/navigation.js
```
do it again for `skip-link-focus-fix.js` code located on line 124.
For customizer g... |
289,556 | <p>I have id of WP category on external resource.
I know that if I have id of post I can create url like</p>
<blockquote>
<p><a href="http://example.com/?p=" rel="nofollow noreferrer">http://example.com/?p=</a>{post_id}</p>
</blockquote>
<p>But what if I know id of category? How can I generate link to it?
Category ... | [
{
"answer_id": 289557,
"author": "janh",
"author_id": 129206,
"author_profile": "https://wordpress.stackexchange.com/users/129206",
"pm_score": 1,
"selected": false,
"text": "<p>use <a href=\"https://developer.wordpress.org/reference/functions/get_term_link/\" rel=\"nofollow noreferrer\"... | 2017/12/27 | [
"https://wordpress.stackexchange.com/questions/289556",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/16650/"
] | I have id of WP category on external resource.
I know that if I have id of post I can create url like
>
> <http://example.com/?p=>{post\_id}
>
>
>
But what if I know id of category? How can I generate link to it?
Category permalinks look like
>
> <http://example.com/category/>{category\_slug}/
>
>
>
and I n... | If you have category ID you can create link to category like below :
```
<a href="/index.php?cat=7">Category Title</a>
```
For more details read from this link :
<https://codex.wordpress.org/Linking_Posts_Pages_and_Categories>
Thanks! |
289,558 | <p>I have recently enabled SSL certificate and I'm tring to use it in my wordpress site. My website's url is </p>
<hr>
<p>All plugings are disabled.</p>
<hr>
<p>I replaced </p>
<pre><code> define('WP_HOME','http://mywebsite.com');
define('WP_SITEURL','http://mywebsite.com');
</code></pre>
<p>with:</p>
<pre><... | [
{
"answer_id": 289557,
"author": "janh",
"author_id": 129206,
"author_profile": "https://wordpress.stackexchange.com/users/129206",
"pm_score": 1,
"selected": false,
"text": "<p>use <a href=\"https://developer.wordpress.org/reference/functions/get_term_link/\" rel=\"nofollow noreferrer\"... | 2017/12/27 | [
"https://wordpress.stackexchange.com/questions/289558",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/16847/"
] | I have recently enabled SSL certificate and I'm tring to use it in my wordpress site. My website's url is
---
All plugings are disabled.
---
I replaced
```
define('WP_HOME','http://mywebsite.com');
define('WP_SITEURL','http://mywebsite.com');
```
with:
```
define('WP_HOME','https://mywebsite.com');
defin... | If you have category ID you can create link to category like below :
```
<a href="/index.php?cat=7">Category Title</a>
```
For more details read from this link :
<https://codex.wordpress.org/Linking_Posts_Pages_and_Categories>
Thanks! |
289,574 | <p>This is my entire code and it is working perfectly in my local system xampp but not working on server.</p>
<pre><code>function taqyeem_dequeue_scrips() {
if(basename($_SERVER['REQUEST_URI'])=='my_page' || basename($_SERVER['REQUEST_URI'])=='')
{
wp_dequeue_style( 'taqyeem-style' );
w... | [
{
"answer_id": 289557,
"author": "janh",
"author_id": 129206,
"author_profile": "https://wordpress.stackexchange.com/users/129206",
"pm_score": 1,
"selected": false,
"text": "<p>use <a href=\"https://developer.wordpress.org/reference/functions/get_term_link/\" rel=\"nofollow noreferrer\"... | 2017/12/27 | [
"https://wordpress.stackexchange.com/questions/289574",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/70096/"
] | This is my entire code and it is working perfectly in my local system xampp but not working on server.
```
function taqyeem_dequeue_scrips() {
if(basename($_SERVER['REQUEST_URI'])=='my_page' || basename($_SERVER['REQUEST_URI'])=='')
{
wp_dequeue_style( 'taqyeem-style' );
wp_dequeue_scri... | If you have category ID you can create link to category like below :
```
<a href="/index.php?cat=7">Category Title</a>
```
For more details read from this link :
<https://codex.wordpress.org/Linking_Posts_Pages_and_Categories>
Thanks! |
289,582 | <p>I need to remove trailing slash from URLs ending with <code>.xml/</code> only .. For this purpose I've created a Rewrite Condition and Rule which is working perfectly fine for the test link <a href="http://website.com/test.xml/" rel="nofollow noreferrer">http://website.com/test.xml/</a></p>
<p>Test Link: <a href="h... | [
{
"answer_id": 289588,
"author": "MrWhite",
"author_id": 8259,
"author_profile": "https://wordpress.stackexchange.com/users/8259",
"pm_score": 1,
"selected": false,
"text": "<blockquote>\n<pre><code>RewriteRule ^ /%1.xml [L]\n</code></pre>\n</blockquote>\n\n<p>This should be an <em>exter... | 2017/12/27 | [
"https://wordpress.stackexchange.com/questions/289582",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/58627/"
] | I need to remove trailing slash from URLs ending with `.xml/` only .. For this purpose I've created a Rewrite Condition and Rule which is working perfectly fine for the test link <http://website.com/test.xml/>
Test Link: <http://htaccess.mwl.be?share=6fe08232-438a-53fa-8f1a-1f7f69b77b6f>
The problem is when I place t... | What exactly worked out for me ..
The issue was due to WordPress canonical redirects .. The use of `/%postname%/` in permalink structure was redirecting the custom template to the trailing slash URL.
I simply removed the `template_redirect` filter for canonical redirects .. and now the link works in both cases i.e. w... |
289,590 | <p>im new with wordpress. im planning to connect wordpress database from my own php code . but i get problem when trying to connect database, everytime i connect always get error result. im using this code</p>
<pre><code>$user_name = "myusername";
$password = "password";
$database = "mydatabasename";
$host_name = "loc... | [
{
"answer_id": 289594,
"author": "D. Dan",
"author_id": 133528,
"author_profile": "https://wordpress.stackexchange.com/users/133528",
"pm_score": 0,
"selected": false,
"text": "<p>Try using <a href=\"https://codex.wordpress.org/Class_Reference/wpdb\" rel=\"nofollow noreferrer\">wpdb</a>.... | 2017/12/27 | [
"https://wordpress.stackexchange.com/questions/289590",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/133890/"
] | im new with wordpress. im planning to connect wordpress database from my own php code . but i get problem when trying to connect database, everytime i connect always get error result. im using this code
```
$user_name = "myusername";
$password = "password";
$database = "mydatabasename";
$host_name = "localhost";
$con... | While it may possible to connect using mysqli->connect it is always better to make use of built in Wordpress functionality (even for external code).
By this I mean that you should use the wpdb class. See <https://codex.wordpress.org/Class_Reference/wpdb> for more information.
First you need to link to the Wordpress c... |
289,600 | <p>Since I'm pretty new to WordPress, I would like to know what is the right way to edit the WP reset password email. I would like to change the message.</p>
<p>I see that I need to edit the <code>retrieve_password_message</code> filter but I cannot understand if I can change the <code>wp-login.php</code> file.</p>
<... | [
{
"answer_id": 289594,
"author": "D. Dan",
"author_id": 133528,
"author_profile": "https://wordpress.stackexchange.com/users/133528",
"pm_score": 0,
"selected": false,
"text": "<p>Try using <a href=\"https://codex.wordpress.org/Class_Reference/wpdb\" rel=\"nofollow noreferrer\">wpdb</a>.... | 2017/12/27 | [
"https://wordpress.stackexchange.com/questions/289600",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/133892/"
] | Since I'm pretty new to WordPress, I would like to know what is the right way to edit the WP reset password email. I would like to change the message.
I see that I need to edit the `retrieve_password_message` filter but I cannot understand if I can change the `wp-login.php` file.
What will happen in case of WP update... | While it may possible to connect using mysqli->connect it is always better to make use of built in Wordpress functionality (even for external code).
By this I mean that you should use the wpdb class. See <https://codex.wordpress.org/Class_Reference/wpdb> for more information.
First you need to link to the Wordpress c... |
289,605 | <p>In my Ubuntu VPS, to search and replace in a DB of a site I do for example:</p>
<pre><code>cd /var/www/html/example.com
sudo wp search-replace "http://" "https://" --all-tables
</code></pre>
<p>Yet in Windows 10 I use XAMPP and can't do this action with WSL + WP-CLI because one cannot use Bash inside windows (yet)... | [
{
"answer_id": 289594,
"author": "D. Dan",
"author_id": 133528,
"author_profile": "https://wordpress.stackexchange.com/users/133528",
"pm_score": 0,
"selected": false,
"text": "<p>Try using <a href=\"https://codex.wordpress.org/Class_Reference/wpdb\" rel=\"nofollow noreferrer\">wpdb</a>.... | 2017/12/27 | [
"https://wordpress.stackexchange.com/questions/289605",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/131001/"
] | In my Ubuntu VPS, to search and replace in a DB of a site I do for example:
```
cd /var/www/html/example.com
sudo wp search-replace "http://" "https://" --all-tables
```
Yet in Windows 10 I use XAMPP and can't do this action with WSL + WP-CLI because one cannot use Bash inside windows (yet).
My problem
----------
... | While it may possible to connect using mysqli->connect it is always better to make use of built in Wordpress functionality (even for external code).
By this I mean that you should use the wpdb class. See <https://codex.wordpress.org/Class_Reference/wpdb> for more information.
First you need to link to the Wordpress c... |
289,622 | <p>I've looked through all the similar threads I can find, and I think I <em>should</em> have all the pieces in place to have translated strings appear, but they are not. I'm about ready to pull out my hair!</p>
<p>Here's what I've got going - I'm making a custom theme (based on the _s starter), and I have added templ... | [
{
"answer_id": 289594,
"author": "D. Dan",
"author_id": 133528,
"author_profile": "https://wordpress.stackexchange.com/users/133528",
"pm_score": 0,
"selected": false,
"text": "<p>Try using <a href=\"https://codex.wordpress.org/Class_Reference/wpdb\" rel=\"nofollow noreferrer\">wpdb</a>.... | 2017/12/27 | [
"https://wordpress.stackexchange.com/questions/289622",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/69989/"
] | I've looked through all the similar threads I can find, and I think I *should* have all the pieces in place to have translated strings appear, but they are not. I'm about ready to pull out my hair!
Here's what I've got going - I'm making a custom theme (based on the \_s starter), and I have added templates for some cu... | While it may possible to connect using mysqli->connect it is always better to make use of built in Wordpress functionality (even for external code).
By this I mean that you should use the wpdb class. See <https://codex.wordpress.org/Class_Reference/wpdb> for more information.
First you need to link to the Wordpress c... |
289,623 | <p>I need to remove some external .js files from source
here is source: view-source:buhehe.de/ausmalbilder/
There is 3 jquery library and I don't know what is difference, why is it not one enough?</p>
<pre><code><script type='text/javascript' src='http://buhehe.de/wp-includes/js/jquery/jquery.js?ver=1.12.4'><... | [
{
"answer_id": 289624,
"author": "Nicolai Grossherr",
"author_id": 22534,
"author_profile": "https://wordpress.stackexchange.com/users/22534",
"pm_score": 2,
"selected": false,
"text": "<p>Firstly: Are you absolutely sure that you don't need them?</p>\n\n<p>Secondly: I'm assuming <code>s... | 2017/12/27 | [
"https://wordpress.stackexchange.com/questions/289623",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/133900/"
] | I need to remove some external .js files from source
here is source: view-source:buhehe.de/ausmalbilder/
There is 3 jquery library and I don't know what is difference, why is it not one enough?
```
<script type='text/javascript' src='http://buhehe.de/wp-includes/js/jquery/jquery.js?ver=1.12.4'></script>
<script type='... | Firstly: Are you absolutely sure that you don't need them?
Secondly: I'm assuming `small-menu.js` is for the mobile menu and `wp-embed.min.js` you want in case you use embeds.
If I'm right, then you might want to keep the former. Aside from that you likely will find a `wp_enqueue_script` line for the former in your... |
289,634 | <p>This is my code:</p>
<pre><code>$args = array (
'order' => 'DESC',
'include' => get_user_meta($author->ID, 'the_following_users', true)
);
$wp_user_query = new WP_User_Query( $args );
$users = $wp_user_query->get_results();
if ( ! empty( $users ) ) {
foreach ( $users as $user ) {
... | [
{
"answer_id": 289636,
"author": "Nicolai Grossherr",
"author_id": 22534,
"author_profile": "https://wordpress.stackexchange.com/users/22534",
"pm_score": 2,
"selected": false,
"text": "<p>The <code>include</code> parameter of <code>WP_User_Query</code> expects an array as argument. So s... | 2017/12/27 | [
"https://wordpress.stackexchange.com/questions/289634",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/133343/"
] | This is my code:
```
$args = array (
'order' => 'DESC',
'include' => get_user_meta($author->ID, 'the_following_users', true)
);
$wp_user_query = new WP_User_Query( $args );
$users = $wp_user_query->get_results();
if ( ! empty( $users ) ) {
foreach ( $users as $user ) {
// Get users
}
}... | I think the problem here is that in the process of violating this rule, you've created confusion and problems:
>
> do 1 thing per statement, 1 statement per line
>
>
>
Coupled with another problem:
>
> Passing arrays to the APIs which get stored as serialised PHP ( security issue )
>
>
>
And another:
>
> ... |
289,640 | <p>I'm using Tevolution. I can't find where I can re-size the flag at the top of this website: <a href="http://www.isupportblack.com/" rel="nofollow noreferrer">isupportblack.com</a> It is blurry and shouldn't be. Any suggestions? Thanks!</p>
| [
{
"answer_id": 289636,
"author": "Nicolai Grossherr",
"author_id": 22534,
"author_profile": "https://wordpress.stackexchange.com/users/22534",
"pm_score": 2,
"selected": false,
"text": "<p>The <code>include</code> parameter of <code>WP_User_Query</code> expects an array as argument. So s... | 2017/12/28 | [
"https://wordpress.stackexchange.com/questions/289640",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/133907/"
] | I'm using Tevolution. I can't find where I can re-size the flag at the top of this website: [isupportblack.com](http://www.isupportblack.com/) It is blurry and shouldn't be. Any suggestions? Thanks! | I think the problem here is that in the process of violating this rule, you've created confusion and problems:
>
> do 1 thing per statement, 1 statement per line
>
>
>
Coupled with another problem:
>
> Passing arrays to the APIs which get stored as serialised PHP ( security issue )
>
>
>
And another:
>
> ... |
289,666 | <p>When I try to upload any PNG file, I get the following error message:</p>
<p><a href="https://i.stack.imgur.com/JYE8w.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JYE8w.png" alt="enter image description here"></a></p>
<p>I have no plugin or anything installed, that could cause this. I even ad... | [
{
"answer_id": 289636,
"author": "Nicolai Grossherr",
"author_id": 22534,
"author_profile": "https://wordpress.stackexchange.com/users/22534",
"pm_score": 2,
"selected": false,
"text": "<p>The <code>include</code> parameter of <code>WP_User_Query</code> expects an array as argument. So s... | 2017/12/28 | [
"https://wordpress.stackexchange.com/questions/289666",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/118091/"
] | When I try to upload any PNG file, I get the following error message:
[](https://i.stack.imgur.com/JYE8w.png)
I have no plugin or anything installed, that could cause this. I even added the following line in order to fix this:
`define('ALLOW_UNFILTE... | I think the problem here is that in the process of violating this rule, you've created confusion and problems:
>
> do 1 thing per statement, 1 statement per line
>
>
>
Coupled with another problem:
>
> Passing arrays to the APIs which get stored as serialised PHP ( security issue )
>
>
>
And another:
>
> ... |
289,690 | <p>I'm trying to figure out how to query posts on a custom post type, using a custom field. </p>
<p>Goal:
On my "artists" single page, I want to display a list of news/album releases for that artist only. Those posts will also show up on the main page. </p>
<p>Concept:<br>
Use a category for each artist on the post... | [
{
"answer_id": 289636,
"author": "Nicolai Grossherr",
"author_id": 22534,
"author_profile": "https://wordpress.stackexchange.com/users/22534",
"pm_score": 2,
"selected": false,
"text": "<p>The <code>include</code> parameter of <code>WP_User_Query</code> expects an array as argument. So s... | 2017/12/28 | [
"https://wordpress.stackexchange.com/questions/289690",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/133951/"
] | I'm trying to figure out how to query posts on a custom post type, using a custom field.
Goal:
On my "artists" single page, I want to display a list of news/album releases for that artist only. Those posts will also show up on the main page.
Concept:
Use a category for each artist on the posts; use a custom fiel... | I think the problem here is that in the process of violating this rule, you've created confusion and problems:
>
> do 1 thing per statement, 1 statement per line
>
>
>
Coupled with another problem:
>
> Passing arrays to the APIs which get stored as serialised PHP ( security issue )
>
>
>
And another:
>
> ... |
289,691 | <p>I tried to remove /category/ base from permalink structure, keeping parent category, but Wordpress gives me back 404 error page.</p>
<p>I'm not using any particular plugin to do that, only using . in category base and using %category%/%postname%/ as permalink structure.</p>
<p>If I restore /category/ base everythi... | [
{
"answer_id": 289636,
"author": "Nicolai Grossherr",
"author_id": 22534,
"author_profile": "https://wordpress.stackexchange.com/users/22534",
"pm_score": 2,
"selected": false,
"text": "<p>The <code>include</code> parameter of <code>WP_User_Query</code> expects an array as argument. So s... | 2017/12/28 | [
"https://wordpress.stackexchange.com/questions/289691",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/103072/"
] | I tried to remove /category/ base from permalink structure, keeping parent category, but Wordpress gives me back 404 error page.
I'm not using any particular plugin to do that, only using . in category base and using %category%/%postname%/ as permalink structure.
If I restore /category/ base everything works fine. I ... | I think the problem here is that in the process of violating this rule, you've created confusion and problems:
>
> do 1 thing per statement, 1 statement per line
>
>
>
Coupled with another problem:
>
> Passing arrays to the APIs which get stored as serialised PHP ( security issue )
>
>
>
And another:
>
> ... |
289,735 | <p>Hi i am using the following to modify the results returned from a search on the users tables in wp admin :</p>
<pre><code>add_action('pre_get_users','custom_user_search');
$query->query_vars['meta_query'] = array(
'relation' => 'OR',
array(
'key' => 'billing_postcode',
'value' => s... | [
{
"answer_id": 289743,
"author": "kierzniak",
"author_id": 132363,
"author_profile": "https://wordpress.stackexchange.com/users/132363",
"pm_score": 0,
"selected": false,
"text": "<p>The query built in this way will search for users by their standard properties <code>AND</code> by this m... | 2017/12/29 | [
"https://wordpress.stackexchange.com/questions/289735",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/101873/"
] | Hi i am using the following to modify the results returned from a search on the users tables in wp admin :
```
add_action('pre_get_users','custom_user_search');
$query->query_vars['meta_query'] = array(
'relation' => 'OR',
array(
'key' => 'billing_postcode',
'value' => str_replace('*', '', $quer... | OK, Here's how I did it :
```
add_action('pre_user_query', 'custom_user_list_queries');
function custom_user_list_queries($query){
if(!empty($query->query_vars['search'])) {
$query->query_from .= " LEFT OUTER JOIN wp_usermeta AS alias ON (wp_users.ID = alias.user_id)";//note use of alias
$query->query_wher... |
289,749 | <p>It is possible to change colors of <a href="https://developer.wordpress.org/resource/dashicons/#chart-bar" rel="nofollow noreferrer">DashIcons</a> with CSS? I couldnt get it to work.</p>
| [
{
"answer_id": 289752,
"author": "DekiGk",
"author_id": 69750,
"author_profile": "https://wordpress.stackexchange.com/users/69750",
"pm_score": 4,
"selected": true,
"text": "<p>Yes, this is possible. Make sure your CSS selector is correct. You can target the specific HTML element or its ... | 2017/12/29 | [
"https://wordpress.stackexchange.com/questions/289749",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/33667/"
] | It is possible to change colors of [DashIcons](https://developer.wordpress.org/resource/dashicons/#chart-bar) with CSS? I couldnt get it to work. | Yes, this is possible. Make sure your CSS selector is correct. You can target the specific HTML element or its `::before` pseudo element and change colour with CSS. Can you post your HTML snippet of the element you want to change and the CSS selector you are using? Maybe you mean to change the colour inside WP admin ar... |
289,759 | <p>Found this and it works, but want to change the 10 MB limit to 5 GB.</p>
<pre><code>$upload_bytes_limit_reached = ( ( $filesize + $upload_bytes ) > ( 1024 * 1024 * 10 ) );
</code></pre>
<hr>
<pre><code>add_filter( 'wp_handle_upload', 'wpse47580_update_upload_stats' );
function wpse47580_update_upload_stats( $a... | [
{
"answer_id": 289765,
"author": "Nicolai Grossherr",
"author_id": 22534,
"author_profile": "https://wordpress.stackexchange.com/users/22534",
"pm_score": 2,
"selected": false,
"text": "<p>You have to set <a href=\"https://wordpress.stackexchange.com/questions/252849/wordpress-media-uplo... | 2017/12/29 | [
"https://wordpress.stackexchange.com/questions/289759",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/133947/"
] | Found this and it works, but want to change the 10 MB limit to 5 GB.
```
$upload_bytes_limit_reached = ( ( $filesize + $upload_bytes ) > ( 1024 * 1024 * 10 ) );
```
---
```
add_filter( 'wp_handle_upload', 'wpse47580_update_upload_stats' );
function wpse47580_update_upload_stats( $args ) {
$size = filesize( $arg... | I have it working. I removed the top half of the script. Don't know why it now works, but tested it and does what I wanted. Thanks for all your help and support. The original thread can be found [here](https://wordpress.stackexchange.com/q/47580/22534), for those interested.
```
add_filter( 'wp_handle_upload_prefilter... |
289,763 | <p>I am using the Enhanced Image Library plugin to automatically add a taxonomy to images uploaded to a custom post type. The plugin has a feature that will allow the post's categories to be automatically added to associated images when the image is uploaded.</p>
<p>However, if the post category is not assigned to the... | [
{
"answer_id": 289765,
"author": "Nicolai Grossherr",
"author_id": 22534,
"author_profile": "https://wordpress.stackexchange.com/users/22534",
"pm_score": 2,
"selected": false,
"text": "<p>You have to set <a href=\"https://wordpress.stackexchange.com/questions/252849/wordpress-media-uplo... | 2017/12/29 | [
"https://wordpress.stackexchange.com/questions/289763",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/134003/"
] | I am using the Enhanced Image Library plugin to automatically add a taxonomy to images uploaded to a custom post type. The plugin has a feature that will allow the post's categories to be automatically added to associated images when the image is uploaded.
However, if the post category is not assigned to the post befo... | I have it working. I removed the top half of the script. Don't know why it now works, but tested it and does what I wanted. Thanks for all your help and support. The original thread can be found [here](https://wordpress.stackexchange.com/q/47580/22534), for those interested.
```
add_filter( 'wp_handle_upload_prefilter... |
289,769 | <p>In the WooCommerce plugin, the PayPal gateway has recently been updated to capture payment on status change TO either "Processing" or "Completed".</p>
<p>We want to ONLY allow capture after order status has been updated to COMPLETED.</p>
<p>In order to do this, I have identified that I need to remove an action. Th... | [
{
"answer_id": 289780,
"author": "Frank P. Walentynowicz",
"author_id": 32851,
"author_profile": "https://wordpress.stackexchange.com/users/32851",
"pm_score": 0,
"selected": false,
"text": "<p>If <em>WooCommerce</em> plugin declares <code>$WC_Gateway_Paypal</code> as global variable:</p... | 2017/12/30 | [
"https://wordpress.stackexchange.com/questions/289769",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/134005/"
] | In the WooCommerce plugin, the PayPal gateway has recently been updated to capture payment on status change TO either "Processing" or "Completed".
We want to ONLY allow capture after order status has been updated to COMPLETED.
In order to do this, I have identified that I need to remove an action. The action is locat... | There are two things that you'll need in order to remove the action.
1. The exact instance of WC\_Gateway\_Paypal
2. Knowing when the action is added and when it is executed
Without these, it will be difficult, but impossible to remove the action. Getting the instance of WC\_Gateway\_Paypal should be straightforward.... |
289,794 | <p>I'm trying to redirect the user to a "Thank you for signing up" page but I can not get it.</p>
<p>This is the code (It's wrong)</p>
<pre><code>function tml_action_url( $url, $action, $instance ) {
if ( 'login' == $action )
$url = 'url/thanks';
return $url;
}
add_filter( 'tml_action_url', 'tml_actio... | [
{
"answer_id": 289780,
"author": "Frank P. Walentynowicz",
"author_id": 32851,
"author_profile": "https://wordpress.stackexchange.com/users/32851",
"pm_score": 0,
"selected": false,
"text": "<p>If <em>WooCommerce</em> plugin declares <code>$WC_Gateway_Paypal</code> as global variable:</p... | 2017/12/30 | [
"https://wordpress.stackexchange.com/questions/289794",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/134019/"
] | I'm trying to redirect the user to a "Thank you for signing up" page but I can not get it.
This is the code (It's wrong)
```
function tml_action_url( $url, $action, $instance ) {
if ( 'login' == $action )
$url = 'url/thanks';
return $url;
}
add_filter( 'tml_action_url', 'tml_action_url', 10, 3 );
?>
... | There are two things that you'll need in order to remove the action.
1. The exact instance of WC\_Gateway\_Paypal
2. Knowing when the action is added and when it is executed
Without these, it will be difficult, but impossible to remove the action. Getting the instance of WC\_Gateway\_Paypal should be straightforward.... |
289,812 | <p>I've never thought to do this with WordPress until now, but I was wondering is it possible for two templates to be chosen to create a post or page in WordPress?</p>
<p>When you are on the 'Edit Page' there is the 'Page Attributes>Template' section. When a custom template is chosen that will generate the main layout... | [
{
"answer_id": 289833,
"author": "admcfajn",
"author_id": 123674,
"author_profile": "https://wordpress.stackexchange.com/users/123674",
"pm_score": 1,
"selected": false,
"text": "<p>No, you would not use two page-templates on a single page.</p>\n\n<p>Yes, you can have a different admin-p... | 2017/12/30 | [
"https://wordpress.stackexchange.com/questions/289812",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/58726/"
] | I've never thought to do this with WordPress until now, but I was wondering is it possible for two templates to be chosen to create a post or page in WordPress?
When you are on the 'Edit Page' there is the 'Page Attributes>Template' section. When a custom template is chosen that will generate the main layout of the pa... | No, you would not use two page-templates on a single page.
Yes, you can have a different admin-page layout / configuration for different page-templates.
Page-template-A could have two post-editors and page-template-B (or post-format for that matter) could have only a name, email, and featured-image.
You could use a... |
289,820 | <p>****SEE Edits below****</p>
<p><strong>Edit added 1/4/2018</strong> I started over again, following the instructions. As far as I can tell everything is correct including the synchronization plugin. fpw-sync-users.php in test.oursite.com 3 occurences of $other_prefixes = array( 'wp5l_', ); fpw-sync-users.php in for... | [
{
"answer_id": 289850,
"author": "Frank P. Walentynowicz",
"author_id": 32851,
"author_profile": "https://wordpress.stackexchange.com/users/32851",
"pm_score": 1,
"selected": false,
"text": "<p>In both <code>wp-config.php</code> files, change the following defines:</p>\n\n<pre><code>defi... | 2017/12/31 | [
"https://wordpress.stackexchange.com/questions/289820",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/134043/"
] | \*\*\*\*SEE Edits below\*\*\*\*
**Edit added 1/4/2018** I started over again, following the instructions. As far as I can tell everything is correct including the synchronization plugin. fpw-sync-users.php in test.oursite.com 3 occurences of $other\_prefixes = array( 'wp5l\_', ); fpw-sync-users.php in forum.oursite.co... | In both `wp-config.php` files, change the following defines:
```
define('COOKIE_DOMAIN', '.test.oursite.com');
define('COOKIEHASH', md5('test.oursite.com'));
```
to:
```
define('COOKIE_DOMAIN', '.oursite.com');
define('COOKIEHASH', md5('oursite.com'));
```
Go to `test.oursite... |
289,836 | <p>i have created a meta box oembed with clone:</p>
<pre><code>function media( $meta_boxes ) {
$prefix = '';
$meta_boxes[] = array(
'id' => 'media_1',
'title' => esc_html__( 'Media', 'media' ),
'post_types' => array( 'post','personal_projects' ),
'context' => 'advan... | [
{
"answer_id": 289837,
"author": "Phaidonas Gialis",
"author_id": 119240,
"author_profile": "https://wordpress.stackexchange.com/users/119240",
"pm_score": 1,
"selected": false,
"text": "<p>i changed the code like this, and now works:</p>\n\n<pre><code>$btsvideoembeds = array();\n$btsvid... | 2017/12/31 | [
"https://wordpress.stackexchange.com/questions/289836",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/119240/"
] | i have created a meta box oembed with clone:
```
function media( $meta_boxes ) {
$prefix = '';
$meta_boxes[] = array(
'id' => 'media_1',
'title' => esc_html__( 'Media', 'media' ),
'post_types' => array( 'post','personal_projects' ),
'context' => 'advanced',
'priority' =... | You could also code it like this :
```
$btsvideoembeds = rwmb_get_value( 'oembed_1', array( 'type' => 'oembed' ) );
foreach ( (array) $btsvideoembeds as $btsvideoembed ) {
printf('%s', wp_oembed_get( $btsvideoembed ) );
``` |
289,868 | <p>that is my source: <a href="http://view-source:buhehe.de" rel="nofollow noreferrer">view-source:buhehe.de</a>
i am trying to deque some script form function.php
i mean these two:</p>
<pre><code><script type="text/javascript" src="http://buhehe.de/wp-content/themes/tema/js/jquery-3.2.1.min.js"></script>
... | [
{
"answer_id": 290029,
"author": "bueltge",
"author_id": 170,
"author_profile": "https://wordpress.stackexchange.com/users/170",
"pm_score": 2,
"selected": false,
"text": "<p>I think is not an problem in your WP installation. The site works as encoding UTF-8, also your feed etc. </p>\n\n... | 2018/01/01 | [
"https://wordpress.stackexchange.com/questions/289868",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/133900/"
] | that is my source: [view-source:buhehe.de](http://view-source:buhehe.de)
i am trying to deque some script form function.php
i mean these two:
```
<script type="text/javascript" src="http://buhehe.de/wp-content/themes/tema/js/jquery-3.2.1.min.js"></script>
<script type='text/javascript' src='http://buhehe.de/wp-include... | I've found the issue.
UTF8 might produce a multibyte string (when using Hebrew characters for example).
Facebook truncates this string a post is shared to keep the description under max number of characters.
However, they might truncate a multibyte character in the middle which will result in UTF8 invalid char... |
289,869 | <p>well i can access the sites: </p>
<pre><code>www.foo.com and
www.bar.com
</code></pre>
<p>but i cannot access the login - the sites are blank.</p>
<pre><code>foo.com/wp-login.php
bar.com/wp-login.php
</code></pre>
<p>i have the following logs.</p>
<pre><code>[Mon Jan 01 16:26:03.229924 2018] [core:notice] [pid... | [
{
"answer_id": 289870,
"author": "Rick Hellewell",
"author_id": 29416,
"author_profile": "https://wordpress.stackexchange.com/users/29416",
"pm_score": 1,
"selected": false,
"text": "<p>You probably have a problem-causing plugin. </p>\n\n<p>Look at the error.log file which will tell you ... | 2018/01/01 | [
"https://wordpress.stackexchange.com/questions/289869",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/130711/"
] | well i can access the sites:
```
www.foo.com and
www.bar.com
```
but i cannot access the login - the sites are blank.
```
foo.com/wp-login.php
bar.com/wp-login.php
```
i have the following logs.
```
[Mon Jan 01 16:26:03.229924 2018] [core:notice] [pid 17589] AH00052: child pid 24869 exit signal Segmentation fa... | You probably have a problem-causing plugin.
Look at the error.log file which will tell you the file that is causing the problem. Rename that plugin's folder (use your hosting control panel's File Manager) and retry. That should get you into the admin area. Then you can contact the plugin's support forum to figure out... |
289,892 | <p>I have made wp_query like below. This is some part of them. And it works.</p>
<pre><code>$args = .....;
$query = new WP_Query($args);
while($query->have_posts() ) :
$query->the_post();
?>
<div class="each">
<h4><?php the_title(); ?> </h4>
</div... | [
{
"answer_id": 289870,
"author": "Rick Hellewell",
"author_id": 29416,
"author_profile": "https://wordpress.stackexchange.com/users/29416",
"pm_score": 1,
"selected": false,
"text": "<p>You probably have a problem-causing plugin. </p>\n\n<p>Look at the error.log file which will tell you ... | 2018/01/02 | [
"https://wordpress.stackexchange.com/questions/289892",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/133185/"
] | I have made wp\_query like below. This is some part of them. And it works.
```
$args = .....;
$query = new WP_Query($args);
while($query->have_posts() ) :
$query->the_post();
?>
<div class="each">
<h4><?php the_title(); ?> </h4>
</div>
<?php endwhile; wp_reset_query(); ?>
```
This... | You probably have a problem-causing plugin.
Look at the error.log file which will tell you the file that is causing the problem. Rename that plugin's folder (use your hosting control panel's File Manager) and retry. That should get you into the admin area. Then you can contact the plugin's support forum to figure out... |
289,929 | <pre><code>if ( ! function_exists( 'loadingscripts' ) ) {
function loadingscripts() {
// Register the script like this for a theme:
wp_register_script( 'custom-js', get_template_directory_uri() . '/js/custom.js', array( 'jquery' ), '1.1', true );
wp_enqueue_script( 'custom-js' );
/* Loa... | [
{
"answer_id": 289932,
"author": "Tom J Nowell",
"author_id": 736,
"author_profile": "https://wordpress.stackexchange.com/users/736",
"pm_score": 2,
"selected": true,
"text": "<p>Javascript runs as soon as it's loaded, you need to wait for the DOM ready event, and you do that in JS, not ... | 2018/01/02 | [
"https://wordpress.stackexchange.com/questions/289929",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/105791/"
] | ```
if ( ! function_exists( 'loadingscripts' ) ) {
function loadingscripts() {
// Register the script like this for a theme:
wp_register_script( 'custom-js', get_template_directory_uri() . '/js/custom.js', array( 'jquery' ), '1.1', true );
wp_enqueue_script( 'custom-js' );
/* Load the s... | Javascript runs as soon as it's loaded, you need to wait for the DOM ready event, and you do that in JS, not in WP:
```
jQuery(document).ready(function(){
/* your code here */
});
``` |
289,957 | <p><img src="https://i.imgur.com/mT1TUjy.png" alt="Taxonomy description"></p>
<p>I want to add some helpful text to the edit-tags screen describing the proper use of each of my custom taxonomies. </p>
<p>I see <a href="https://codex.wordpress.org/Function_Reference/register_taxonomy" rel="nofollow noreferrer">in the ... | [
{
"answer_id": 289963,
"author": "David Sword",
"author_id": 132362,
"author_profile": "https://wordpress.stackexchange.com/users/132362",
"pm_score": 2,
"selected": true,
"text": "<p>The code for where you've circled can be found in <code>wp-admin/edit-tags.php:295</code></p>\n\n<p>You'... | 2018/01/02 | [
"https://wordpress.stackexchange.com/questions/289957",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/82256/"
] | 
I want to add some helpful text to the edit-tags screen describing the proper use of each of my custom taxonomies.
I see [in the Codex](https://codex.wordpress.org/Function_Reference/register_taxonomy) that a description can be added to a custom taxonomy — not... | The code for where you've circled can be found in `wp-admin/edit-tags.php:295`
You'll notice there's nothing there. No hooks, no filters. You're out of luck for tapping into that cleanly.
Luckily you can do a duct tape method to still add it with jQuery. You can dynamically put text where you've circled by doing som... |
289,979 | <p>I have a problem with my wordpress site logo. I cannot make the site logo dynamic. </p>
<p>here is my code (displaying logo) which is in header.php page: </p>
<pre><code><a href="<?php echo get_home_url(); ?>" id="logo">
<img src="<?php echo get_template_directory_uri(); ?>/assets/images/... | [
{
"answer_id": 289980,
"author": "Tarang koradiya",
"author_id": 128666,
"author_profile": "https://wordpress.stackexchange.com/users/128666",
"pm_score": 2,
"selected": true,
"text": "<p>Theme header logo function <code>get_theme_mod( 'custom_logo' );</code></p>\n\n<pre><code>$custom_lo... | 2018/01/03 | [
"https://wordpress.stackexchange.com/questions/289979",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/132874/"
] | I have a problem with my wordpress site logo. I cannot make the site logo dynamic.
here is my code (displaying logo) which is in header.php page:
```
<a href="<?php echo get_home_url(); ?>" id="logo">
<img src="<?php echo get_template_directory_uri(); ?>/assets/images/logo.png" class="img-responsive" alt="" ti... | Theme header logo function `get_theme_mod( 'custom_logo' );`
```
$custom_logo_id = get_theme_mod( 'custom_logo' );
$image = wp_get_attachment_image_src( $custom_logo_id , 'full' );
echo '<img class="header_logo" src="'.$image[0].'">';
``` |
289,997 | <p>I have the following in my database</p>
<pre><code>siteurl subdomain.example.com
home subdomain.example.com
</code></pre>
<p>and when I attempt to go to some pages, the pages go to <code>subdomain.example.com/services/subdomain.example.com</code></p>
<p>Is there any reason why this would happen? I can't ... | [
{
"answer_id": 289980,
"author": "Tarang koradiya",
"author_id": 128666,
"author_profile": "https://wordpress.stackexchange.com/users/128666",
"pm_score": 2,
"selected": true,
"text": "<p>Theme header logo function <code>get_theme_mod( 'custom_logo' );</code></p>\n\n<pre><code>$custom_lo... | 2018/01/03 | [
"https://wordpress.stackexchange.com/questions/289997",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/134191/"
] | I have the following in my database
```
siteurl subdomain.example.com
home subdomain.example.com
```
and when I attempt to go to some pages, the pages go to `subdomain.example.com/services/subdomain.example.com`
Is there any reason why this would happen? I can't get into the wp-admin either because of this... | Theme header logo function `get_theme_mod( 'custom_logo' );`
```
$custom_logo_id = get_theme_mod( 'custom_logo' );
$image = wp_get_attachment_image_src( $custom_logo_id , 'full' );
echo '<img class="header_logo" src="'.$image[0].'">';
``` |
289,999 | <p>How can i change the recent post widget title programmatically?</p>
<p>I use this code in my footer.php to add recent posts widget.</p>
<pre><code><?php the_widget( 'WP_Widget_Recent_Posts' ); ?>
</code></pre>
| [
{
"answer_id": 290002,
"author": "Mostafa Norzade",
"author_id": 131388,
"author_profile": "https://wordpress.stackexchange.com/users/131388",
"pm_score": 1,
"selected": false,
"text": "<p>One of the ways is:</p>\n\n<p>1) Rename the Widget class name</p>\n\n<p>2) Modify the Widget class<... | 2018/01/03 | [
"https://wordpress.stackexchange.com/questions/289999",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/132099/"
] | How can i change the recent post widget title programmatically?
I use this code in my footer.php to add recent posts widget.
```
<?php the_widget( 'WP_Widget_Recent_Posts' ); ?>
``` | I had a similar situation. Add the following code to your functions.php and see if it works for you.
```
function my_widget_title($title, $instance, $id_base) {
if ( 'recent-posts' == $id_base) {
return __('New Title');
}
else {
return $title;
}
}
add_filter ( 'widget_title'... |
290,005 | <p>I would like to generate a simple text report for a Wordpress instance listing:</p>
<ul>
<li>Wordpress version</li>
<li>plugins installed (version and whether enabled)</li>
<li>themes and child themes installed (version and whether enabled)</li>
</ul>
<p>I can get this information from the Dashboard, but is there ... | [
{
"answer_id": 290020,
"author": "lofidevops",
"author_id": 31388,
"author_profile": "https://wordpress.stackexchange.com/users/31388",
"pm_score": 2,
"selected": false,
"text": "<p>Using WP CLI, you can record Wordpress version using:</p>\n\n<pre><code>wp core version --extra --path=\"$... | 2018/01/03 | [
"https://wordpress.stackexchange.com/questions/290005",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/31388/"
] | I would like to generate a simple text report for a Wordpress instance listing:
* Wordpress version
* plugins installed (version and whether enabled)
* themes and child themes installed (version and whether enabled)
I can get this information from the Dashboard, but is there a way to get it programmatically (with WP ... | Using WP CLI, you can record Wordpress version using:
```
wp core version --extra --path="$SITEPATH" > wp-report.txt
```
and append a list of plugins (with status and version):
```
wp plugin list --path="$SITEPATH" >> wp-report.txt
```
and append a list of themes (with status and version) using:
```
wp theme lis... |
290,015 | <p>I am developing a free theme and users can download it from WordPress.org. I am working on pro version of the same theme. What should be the name of the pro version's folder? </p>
<p>My theme's name is BizPoint. If I name the pro version's folder as 'BizPoint-Pro', whatever changes the user has done using customize... | [
{
"answer_id": 290020,
"author": "lofidevops",
"author_id": 31388,
"author_profile": "https://wordpress.stackexchange.com/users/31388",
"pm_score": 2,
"selected": false,
"text": "<p>Using WP CLI, you can record Wordpress version using:</p>\n\n<pre><code>wp core version --extra --path=\"$... | 2018/01/03 | [
"https://wordpress.stackexchange.com/questions/290015",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/128132/"
] | I am developing a free theme and users can download it from WordPress.org. I am working on pro version of the same theme. What should be the name of the pro version's folder?
My theme's name is BizPoint. If I name the pro version's folder as 'BizPoint-Pro', whatever changes the user has done using customizer, are los... | Using WP CLI, you can record Wordpress version using:
```
wp core version --extra --path="$SITEPATH" > wp-report.txt
```
and append a list of plugins (with status and version):
```
wp plugin list --path="$SITEPATH" >> wp-report.txt
```
and append a list of themes (with status and version) using:
```
wp theme lis... |
290,018 | <p>I am testing plugin upgrades on a staging instance before applying them to production. But if there are any delays in this process, I may end up being prompted to upgrade to a newer, untested version on production.</p>
<p>If prompted to upgrade a plugin, how can I choose an intermediary update, rather than the late... | [
{
"answer_id": 290019,
"author": "kero",
"author_id": 108180,
"author_profile": "https://wordpress.stackexchange.com/users/108180",
"pm_score": 6,
"selected": true,
"text": "<p>Using WP-CLI you can specify this as described in the <a href=\"https://developer.wordpress.org/cli/commands/pl... | 2018/01/03 | [
"https://wordpress.stackexchange.com/questions/290018",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/31388/"
] | I am testing plugin upgrades on a staging instance before applying them to production. But if there are any delays in this process, I may end up being prompted to upgrade to a newer, untested version on production.
If prompted to upgrade a plugin, how can I choose an intermediary update, rather than the latest? | Using WP-CLI you can specify this as described in the [official documentation](https://developer.wordpress.org/cli/commands/plugin/update/).
```
$ wp plugin update <plugin>
```
Using either of the following arguments
```
--minor
```
>
> Only perform updates for minor releases (e.g. from 1.3 to 1.4 instead of 2.0... |
290,022 | <p>I'm trying to configure the WordPress cookie expiration time, but for some reason it's not working. I went here:</p>
<p><a href="https://developer.wordpress.org/reference/hooks/auth_cookie_expiration/" rel="nofollow noreferrer">https://developer.wordpress.org/reference/hooks/auth_cookie_expiration/</a></p>
<p>And ... | [
{
"answer_id": 290024,
"author": "birgire",
"author_id": 26350,
"author_profile": "https://wordpress.stackexchange.com/users/26350",
"pm_score": 2,
"selected": true,
"text": "<p>Note that you're not adding any filter callback with:</p>\n\n<pre><code>apply_filters( 'auth_cookie_expiration... | 2018/01/03 | [
"https://wordpress.stackexchange.com/questions/290022",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/33019/"
] | I'm trying to configure the WordPress cookie expiration time, but for some reason it's not working. I went here:
<https://developer.wordpress.org/reference/hooks/auth_cookie_expiration/>
And put the following hook based on the doc:
```
function init() {
// ...
$expiration = 60;
apply_filters( 'auth_cooki... | Note that you're not adding any filter callback with:
```
apply_filters( 'auth_cookie_expiration', $expiration );
```
Instead use:
```
add_filter( 'auth_cookie_expiration', $callback, 10, 3 );
```
where `$callback` is the appropriate filter callback that modifies the expiration.
Here's an example
```
add_filte... |
290,030 | <p>I have an <code>add_filter</code> function for the <code>auth_cookie_expiration</code> hook. This hook accepts three parameters. However, I am interested in passing it more parameters. For example:</p>
<pre><code>add_filter( 'auth_cookie_expiration', 'get_expiration', 10, 5 );
</code></pre>
<p>This would be possib... | [
{
"answer_id": 290076,
"author": "Frank P. Walentynowicz",
"author_id": 32851,
"author_profile": "https://wordpress.stackexchange.com/users/32851",
"pm_score": 2,
"selected": false,
"text": "<blockquote>\n <p>Am I misunderstanding how add_filter is supposed to work?</p>\n</blockquote>\n... | 2018/01/03 | [
"https://wordpress.stackexchange.com/questions/290030",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/33019/"
] | I have an `add_filter` function for the `auth_cookie_expiration` hook. This hook accepts three parameters. However, I am interested in passing it more parameters. For example:
```
add_filter( 'auth_cookie_expiration', 'get_expiration', 10, 5 );
```
This would be possible with `apply_filter`, but the `add_filter` fun... | The second parameter in `add_filter` is a function with **accepted arguments**, not returned values.
This is an example how I pass my custom array `$args` to change an existing array `$filter_args`:
```
add_filter( 'woocommerce_dropdown_variation_attribute_options_args', function( $filter_args ) use ( $args ) {
... |
290,036 | <p>I don't know why the SHOW ALL is not displaying. It needs to display when the there are more than 6 posts under BOOKS. </p>
<pre><code><?php
for($k=0;$k<count($results);$k++){
$ID = $results[$k]['book_id'];
$args = array('p' => $ID, 'post_type' => 'attraction');
$loop = new WP_Query($args);
$book_img =... | [
{
"answer_id": 290076,
"author": "Frank P. Walentynowicz",
"author_id": 32851,
"author_profile": "https://wordpress.stackexchange.com/users/32851",
"pm_score": 2,
"selected": false,
"text": "<blockquote>\n <p>Am I misunderstanding how add_filter is supposed to work?</p>\n</blockquote>\n... | 2018/01/03 | [
"https://wordpress.stackexchange.com/questions/290036",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/134208/"
] | I don't know why the SHOW ALL is not displaying. It needs to display when the there are more than 6 posts under BOOKS.
```
<?php
for($k=0;$k<count($results);$k++){
$ID = $results[$k]['book_id'];
$args = array('p' => $ID, 'post_type' => 'attraction');
$loop = new WP_Query($args);
$book_img = get_the_post_thumbnail( $... | The second parameter in `add_filter` is a function with **accepted arguments**, not returned values.
This is an example how I pass my custom array `$args` to change an existing array `$filter_args`:
```
add_filter( 'woocommerce_dropdown_variation_attribute_options_args', function( $filter_args ) use ( $args ) {
... |
290,037 | <pre><code><img src="<?php echo get_bloginfo('template_url') ?>/images/logo.png"/>
</code></pre>
<p>Is the above still a relevant method of embedding images in the Wordpress theme or an obsolete?</p>
<p>If obsolete then what will be the correct method?</p>
<p>someone questioned me today that I am not doi... | [
{
"answer_id": 290076,
"author": "Frank P. Walentynowicz",
"author_id": 32851,
"author_profile": "https://wordpress.stackexchange.com/users/32851",
"pm_score": 2,
"selected": false,
"text": "<blockquote>\n <p>Am I misunderstanding how add_filter is supposed to work?</p>\n</blockquote>\n... | 2018/01/03 | [
"https://wordpress.stackexchange.com/questions/290037",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/105791/"
] | ```
<img src="<?php echo get_bloginfo('template_url') ?>/images/logo.png"/>
```
Is the above still a relevant method of embedding images in the Wordpress theme or an obsolete?
If obsolete then what will be the correct method?
someone questioned me today that I am not doing it correctly? | The second parameter in `add_filter` is a function with **accepted arguments**, not returned values.
This is an example how I pass my custom array `$args` to change an existing array `$filter_args`:
```
add_filter( 'woocommerce_dropdown_variation_attribute_options_args', function( $filter_args ) use ( $args ) {
... |
290,075 | <p>Is there a way to bold a specific word or part of a widget title? For example the title "Foo Bar", "Foo" here would be bold.</p>
<p>I tried doing the following, but the span gets outputted in the title:</p>
<pre><code>add_filter( 'widget_title', 'test', 10, 1);
function test( $content ) {
$test = explode(' ', ... | [
{
"answer_id": 290079,
"author": "David Sword",
"author_id": 132362,
"author_profile": "https://wordpress.stackexchange.com/users/132362",
"pm_score": 2,
"selected": false,
"text": "<p>This bolds the first words (or entire word, if only one) of my widget titles:</p>\n\n<pre><code>add_fil... | 2018/01/03 | [
"https://wordpress.stackexchange.com/questions/290075",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/90300/"
] | Is there a way to bold a specific word or part of a widget title? For example the title "Foo Bar", "Foo" here would be bold.
I tried doing the following, but the span gets outputted in the title:
```
add_filter( 'widget_title', 'test', 10, 1);
function test( $content ) {
$test = explode(' ', $content);
if ( ... | This bolds the first words (or entire word, if only one) of my widget titles:
```
add_filter( 'widget_title', function ( $title ) {
return preg_replace("/^(.+?)( |$)/", "<strong>$0</strong>", $title, 1);
}, 10, 1);
```
Breaking down the regex pattern, we have:
* `^` is the start of the line
* `(.+?)` is anythin... |
290,090 | <p>I have created a custom post type called Course Documents using WordPress <a href="https://wordpress.org/plugins/custom-post-type-ui/" rel="nofollow noreferrer">Custom Post Type UI</a> plugin.
Also, I have created a new user role called Teacher.</p>
<pre><code>add_role('rpt_teacher',
'Teacher',
... | [
{
"answer_id": 290093,
"author": "Sid",
"author_id": 110516,
"author_profile": "https://wordpress.stackexchange.com/users/110516",
"pm_score": 1,
"selected": false,
"text": "<p>The way I see it, you are on the right track. You created a user and assign new capabilities to it. You just mi... | 2018/01/04 | [
"https://wordpress.stackexchange.com/questions/290090",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/66897/"
] | I have created a custom post type called Course Documents using WordPress [Custom Post Type UI](https://wordpress.org/plugins/custom-post-type-ui/) plugin.
Also, I have created a new user role called Teacher.
```
add_role('rpt_teacher',
'Teacher',
array(
'read' => true,
... | I don't think the plugin adds the capabilities you are using in `add_cap` while registering the post type.
You can modify the registered post type by adding code to themes `functions.php` file. You can do something like this.
```
/**
* Overwrite args of custom post type registered by plugin
*/
add_filter( 'register... |
290,118 | <pre><code> wp_editor( $default_content, $editor_id,array('textarea_name' => $option_name,'media_buttons' => false,'editor_height' => 350,'teeny' => true) );
submit_button('Save', 'primary');
</code></pre>
<p>I want to create a mail template where admin can change content and put shortcode where he ... | [
{
"answer_id": 290329,
"author": "result",
"author_id": 134376,
"author_profile": "https://wordpress.stackexchange.com/users/134376",
"pm_score": -1,
"selected": false,
"text": "<p>Very simple</p>\n\n<p>if (isset($_POST[$editor_id])){\n update_option('name_option_you_want', $editor_id... | 2018/01/04 | [
"https://wordpress.stackexchange.com/questions/290118",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/96956/"
] | ```
wp_editor( $default_content, $editor_id,array('textarea_name' => $option_name,'media_buttons' => false,'editor_height' => 350,'teeny' => true) );
submit_button('Save', 'primary');
```
I want to create a mail template where admin can change content and put shortcode where he wants.
created a form and wro... | ```
echo '<form action="" class="booked-settings-form" method="post">';
$default_content='<p>Mail formate</p>';
$editor_id = 'customerCleanerMail';
$option_name='customerCleanerMail';
$default_content=html_entity_decode($default_content);
$default_content=stripslashes($default_content);
wp_editor( $default_content, $ed... |
290,120 | <p>I have two custom fields, and both have numeric values:</p>
<p>tnid_01</p>
<p>tnid_01old</p>
<p>Custom Field 'tnid_01' exists for all posts.</p>
<p>Custom Field 'tnid_01old' only exists for some posts.</p>
<p>I am trying to replace the value of 'tnid_01' with the value of 'tnid_01old', but only if 'tnid_01old'... | [
{
"answer_id": 290329,
"author": "result",
"author_id": 134376,
"author_profile": "https://wordpress.stackexchange.com/users/134376",
"pm_score": -1,
"selected": false,
"text": "<p>Very simple</p>\n\n<p>if (isset($_POST[$editor_id])){\n update_option('name_option_you_want', $editor_id... | 2018/01/04 | [
"https://wordpress.stackexchange.com/questions/290120",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/110297/"
] | I have two custom fields, and both have numeric values:
tnid\_01
tnid\_01old
Custom Field 'tnid\_01' exists for all posts.
Custom Field 'tnid\_01old' only exists for some posts.
I am trying to replace the value of 'tnid\_01' with the value of 'tnid\_01old', but only if 'tnid\_01old' exists.
This is what i have so... | ```
echo '<form action="" class="booked-settings-form" method="post">';
$default_content='<p>Mail formate</p>';
$editor_id = 'customerCleanerMail';
$option_name='customerCleanerMail';
$default_content=html_entity_decode($default_content);
$default_content=stripslashes($default_content);
wp_editor( $default_content, $ed... |
290,128 | <p>The code in question →</p>
<pre><code><?php if ( has_post_thumbnail() ) {the_post_thumbnail();} ?>
</code></pre>
<p>The generated output in <strong>browser</strong> is like this → </p>
<pre><code><img width="1620" height="973" src="..../site04/wp-content/uploads/2018/01/audi_ileana.jpg" class="attachment... | [
{
"answer_id": 290131,
"author": "Andrew",
"author_id": 50767,
"author_profile": "https://wordpress.stackexchange.com/users/50767",
"pm_score": 3,
"selected": true,
"text": "<p>You can use a filter to remove height and width attributes from images, as explained in this <a href=\"https://... | 2018/01/04 | [
"https://wordpress.stackexchange.com/questions/290128",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/105791/"
] | The code in question →
```
<?php if ( has_post_thumbnail() ) {the_post_thumbnail();} ?>
```
The generated output in **browser** is like this →
```
<img width="1620" height="973" src="..../site04/wp-content/uploads/2018/01/audi_ileana.jpg" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="" s... | You can use a filter to remove height and width attributes from images, as explained in this [CSS Tricks](https://css-tricks.com/snippets/wordpress/remove-width-and-height-attributes-from-inserted-images/). Place the following in your themes `functions.php` file.
```
add_filter( 'post_thumbnail_html', 'remove_width_at... |
290,139 | <p>I am using a hook from Paid Membership pro to add ACF fields on a registration form.</p>
<pre><code>function insert_acf() {
echo "<p><div id='content-creator'>Test</div></p>
<p><?php the_field('organisation_name'); ?></p>";
};
add_action('pmpro_checkout_before_sub... | [
{
"answer_id": 290131,
"author": "Andrew",
"author_id": 50767,
"author_profile": "https://wordpress.stackexchange.com/users/50767",
"pm_score": 3,
"selected": true,
"text": "<p>You can use a filter to remove height and width attributes from images, as explained in this <a href=\"https://... | 2018/01/04 | [
"https://wordpress.stackexchange.com/questions/290139",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/133457/"
] | I am using a hook from Paid Membership pro to add ACF fields on a registration form.
```
function insert_acf() {
echo "<p><div id='content-creator'>Test</div></p>
<p><?php the_field('organisation_name'); ?></p>";
};
add_action('pmpro_checkout_before_submit_button','insert_acf');
```
Problem 1: The test div... | You can use a filter to remove height and width attributes from images, as explained in this [CSS Tricks](https://css-tricks.com/snippets/wordpress/remove-width-and-height-attributes-from-inserted-images/). Place the following in your themes `functions.php` file.
```
add_filter( 'post_thumbnail_html', 'remove_width_at... |
290,143 | <p>I wanted to add a new image size to the theme I have. But the image sizes are not working correctly.</p>
<p>My code:</p>
<pre><code>add_theme_support( 'post-thumbnails' );
add_image_size( 'bch-microsite-slider-image', 1450, 620 );
add_image_size( 'bch-microsite-hero-image', 1450, 315 );
add_image_size( 'bc... | [
{
"answer_id": 290131,
"author": "Andrew",
"author_id": 50767,
"author_profile": "https://wordpress.stackexchange.com/users/50767",
"pm_score": 3,
"selected": true,
"text": "<p>You can use a filter to remove height and width attributes from images, as explained in this <a href=\"https://... | 2018/01/04 | [
"https://wordpress.stackexchange.com/questions/290143",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/78341/"
] | I wanted to add a new image size to the theme I have. But the image sizes are not working correctly.
My code:
```
add_theme_support( 'post-thumbnails' );
add_image_size( 'bch-microsite-slider-image', 1450, 620 );
add_image_size( 'bch-microsite-hero-image', 1450, 315 );
add_image_size( 'bch-microsite-blog-image... | You can use a filter to remove height and width attributes from images, as explained in this [CSS Tricks](https://css-tricks.com/snippets/wordpress/remove-width-and-height-attributes-from-inserted-images/). Place the following in your themes `functions.php` file.
```
add_filter( 'post_thumbnail_html', 'remove_width_at... |
290,147 | <p>I'm making a skin for The Grid plugin (<a href="https://theme-one.com/docs/the-grid/#developer_guide" rel="nofollow noreferrer">https://theme-one.com/docs/the-grid/#developer_guide</a>).</p>
<p>All the products are virtual and downloadable — I've managed to make an add to cart function, but need to download product... | [
{
"answer_id": 291312,
"author": "Dannie Herdyawan",
"author_id": 68053,
"author_profile": "https://wordpress.stackexchange.com/users/68053",
"pm_score": 0,
"selected": false,
"text": "<pre><code><?php \n $downloads = $product->get_files... | 2018/01/04 | [
"https://wordpress.stackexchange.com/questions/290147",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/134263/"
] | I'm making a skin for The Grid plugin (<https://theme-one.com/docs/the-grid/#developer_guide>).
All the products are virtual and downloadable — I've managed to make an add to cart function, but need to download products instantly too. Is there a meta key for the file url (combed the database and couldn't spot one) or ... | ```
<?php $downloads = $product->get_files();
foreach( $downloads as $key => $download ) {
echo '<p class="download-link"><a href="' . esc_url( $download['file'] ) . '">' . $download['name'] . '</a></p>';
} ?>
```
Check this.. Worked for me. |
290,175 | <p>My theme has an option on its page builder called "show portfolio category filter buttons" which places filter buttons for portfolio categories. As you can see from the following link, it fetches my portfolio categories, but when i push the buttons its not doing anyting. It was working before but it suddenly stopped... | [
{
"answer_id": 290186,
"author": "Cedon",
"author_id": 80069,
"author_profile": "https://wordpress.stackexchange.com/users/80069",
"pm_score": 1,
"selected": false,
"text": "<p>Looks like there maybe a problem with your <code>plugins.js</code> on line 35 according to my console. I'm gett... | 2018/01/04 | [
"https://wordpress.stackexchange.com/questions/290175",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/130811/"
] | My theme has an option on its page builder called "show portfolio category filter buttons" which places filter buttons for portfolio categories. As you can see from the following link, it fetches my portfolio categories, but when i push the buttons its not doing anyting. It was working before but it suddenly stopped wo... | Looks like there maybe a problem with your `plugins.js` on line 35 according to my console. I'm getting the error `TypeError: portfolioContainer.imagesLoaded is not a function.`
The code in question is:
```
if (jQuery().isotope){
var portfolioContainer = jQuery('.w-portfolio.type_sortable .w-portfolio-list-h'... |