Skip to content

Commit 7729aff

Browse files
committed
Add filters for wp_remote_post() arguments.
1 parent 1f070aa commit 7729aff

1 file changed

Lines changed: 24 additions & 3 deletions

File tree

classes/wp-async-request.php

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,17 @@ protected function get_query_args() {
9797
return $this->query_args;
9898
}
9999

100-
return array(
100+
$args = array(
101101
'action' => $this->identifier,
102102
'nonce' => wp_create_nonce( $this->identifier ),
103103
);
104+
105+
/**
106+
* Filters the post arguments used during an async request.
107+
*
108+
* @param array $url
109+
*/
110+
return apply_filters( $this->identifier . '_query_args', $args );
104111
}
105112

106113
/**
@@ -113,7 +120,14 @@ protected function get_query_url() {
113120
return $this->query_url;
114121
}
115122

116-
return admin_url( 'admin-ajax.php' );
123+
$url = admin_url( 'admin-ajax.php' );
124+
125+
/**
126+
* Filters the post arguments used during an async request.
127+
*
128+
* @param string $url
129+
*/
130+
return apply_filters( $this->identifier . '_query_url', $url );
117131
}
118132

119133
/**
@@ -126,13 +140,20 @@ protected function get_post_args() {
126140
return $this->post_args;
127141
}
128142

129-
return array(
143+
$args = array(
130144
'timeout' => 0.01,
131145
'blocking' => false,
132146
'body' => $this->data,
133147
'cookies' => $_COOKIE,
134148
'sslverify' => apply_filters( 'https_local_ssl_verify', false ),
135149
);
150+
151+
/**
152+
* Filters the post arguments used during an async request.
153+
*
154+
* @param array $args
155+
*/
156+
return apply_filters( $this->identifier . '_post_args', $args );
136157
}
137158

138159
/**

0 commit comments

Comments
 (0)