<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: GeorgeMurphy-1</title>
    <description>The latest articles on Forem by GeorgeMurphy-1 (@georgemurphy).</description>
    <link>https://forem.com/georgemurphy</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1167246%2Fb352764f-3a46-466c-9bb7-f1e58ee3f97b.png</url>
      <title>Forem: GeorgeMurphy-1</title>
      <link>https://forem.com/georgemurphy</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/georgemurphy"/>
    <language>en</language>
    <item>
      <title>Exploring the Impact of Early Project Task Completion: A Stochastic Modeling Journey</title>
      <dc:creator>GeorgeMurphy-1</dc:creator>
      <pubDate>Wed, 15 Nov 2023 21:53:34 +0000</pubDate>
      <link>https://forem.com/georgemurphy/exploring-the-impact-of-early-project-task-completion-a-stochastic-modeling-journey-56h7</link>
      <guid>https://forem.com/georgemurphy/exploring-the-impact-of-early-project-task-completion-a-stochastic-modeling-journey-56h7</guid>
      <description>&lt;h2&gt;
  
  
  Part 1: Unveiling the Stochastic Simulation
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;br&gt;
Welcome to the first part of our exploration into the impact of early task completion on project success. In this installment, we unveil the foundational stochastic simulation model that will serve as the canvas for our mathematical journey. Prepare to immerse yourself in the realm of differential equations and Python scripting.&lt;/p&gt;

&lt;p&gt;The Hypothesis&lt;br&gt;
At the heart of our investigation lies a hypothesis: initiating a project with a high task completion rate can positively influence overall project success. To test this, we turn to the world of stochastic processes and differential equations.&lt;/p&gt;

&lt;p&gt;The Stochastic Differential Equation&lt;br&gt;
Our primary tool is a stochastic differential equation, a mathematical framework that elegantly combines deterministic and stochastic components. The equation takes the form:&lt;/p&gt;

&lt;p&gt;dP(t)=(μ(t)P(t)(1−P(t)))dt+(σ(t)P(t)(1−P(t)))dW(t)&lt;/p&gt;

&lt;p&gt;Let's break it down:&lt;/p&gt;

&lt;p&gt;P(t): Probability of task completion at time &lt;/p&gt;

&lt;p&gt;μ(t): Deterministic part of the growth rate.&lt;br&gt;
σ(t): Volatility term, representing uncertainty.&lt;br&gt;
dW(t): Wiener process, introducing randomness.&lt;/p&gt;
&lt;h2&gt;
  
  
  Implementing the Simulation
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Coding the Model&lt;/strong&gt;&lt;br&gt;
Our journey commences with translating the math to Python. I use  NumPy and Matplotlib to create the simulation of the time series for completion rates.&lt;/p&gt;

&lt;p&gt;python&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import Slider

# Function to simulate task completion rates
def simulate_completion_rate(num_steps, dt, a, b, c, noise_type):
    # Initialize arrays to store time and completion rate
    time = np.zeros(num_steps)
    completion_rate = np.zeros(num_steps)

    # Initial values
    time[0] = 0
    completion_rate[0] = 0.2  # Initial completion rate (adjust as needed)

    # Generate Wiener process (Brownian motion)


    if noise_type == 'normal':
        dW = np.random.normal(0, np.sqrt(dt), 1)
    elif noise_type == 'brownian':

        dW = np.random.normal(0,np.random.standard_normal(1) * np.sqrt(dt), num_steps - 1)
    else:
        raise ValueError("Invalid noise type. Choose 'normal' or 'brownian'.")


    # Simulation loop
    for i in range(1, num_steps):
        # Deterministic part of the growth rate
        mu = a + b * time[i - 1]

        # Volatility term
        sigma = c * completion_rate[i - 1]

        # Stochastic differential equation
        dP = mu * completion_rate[i - 1] * (1 - completion_rate[i - 1]) * dt + sigma * completion_rate[i - 1] * (1 - completion_rate[i - 1]) * dW[i - 1]

        # Update time and completion rate
        time[i] = time[i - 1] + dt
        completion_rate[i] = completion_rate[i - 1] + dP

    return time, completion_rate

# Simulation parameters
num_steps = 1000
dt = 0.1
a = 0.1
b = 0.02
c = 0.1

# Create figure and axes
fig, ax = plt.subplots()
plt.subplots_adjust(bottom=0.25)  # Adjust the bottom to make room for sliders

# Plot the initial results
time, completion_rate = simulate_completion_rate(num_steps, dt, a, b, c, noise_type="brownian")
line, = ax.plot(time, completion_rate)
ax.set_title('Task Completion Rate Over Time')
ax.set_xlabel('Time')
ax.set_ylabel('Completion Rate')

# Add sliders for adjusting parameters
axcolor = 'lightgoldenrodyellow'
ax_a = plt.axes([0.25, 0.1, 0.65, 0.03], facecolor=axcolor)
ax_b = plt.axes([0.25, 0.05, 0.65, 0.03], facecolor=axcolor)
ax_c = plt.axes([0.25, 0.00, 0.65, 0.03], facecolor=axcolor)

s_a = Slider(ax_a, 'a', 0.01, 1.0, valinit=a)
s_b = Slider(ax_b, 'b', 0.01, 0.1, valinit=b)
s_c = Slider(ax_c, 'c', 0.01, 1.0, valinit=c)

def update(val):
    a = s_a.val
    b = s_b.val
    c = s_c.val
    time, completion_rate = simulate_completion_rate(num_steps, dt, a, b, c, noise_type="brownian")
    line.set_ydata(completion_rate)
    fig.canvas.draw_idle()

s_a.on_changed(update)
s_b.on_changed(update)
s_c.on_changed(update)

plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Tuning Parameters&lt;/strong&gt;&lt;br&gt;
To ensure the accuracy and relevance of our simulation, selecting appropriate parameters is crucial. The baseline completion rate (a), rate of change (b), and volatility (c) need data to find . This may involve data analysis, historical project insights, or expert input.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Running the Simulation&lt;/strong&gt;&lt;br&gt;
Executing the Python script sets the simulation in motion. The output, a dynamic plot depicting completion rates over time, serves as the visual foundation for our exploration.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8BvJvU7h--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yqpkkplim2deesc8fjhx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8BvJvU7h--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yqpkkplim2deesc8fjhx.png" alt="Simulation" width="800" height="679"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Next Steps&lt;/strong&gt;&lt;br&gt;
As we embark on this mathematical journey, part two will delve into scenario exploration, statistical analysis, and the interpretation of our simulation results. Brace yourself for a deeper dive into the intricacies of project dynamics and mathematical modeling.&lt;/p&gt;

&lt;p&gt;Stay tuned for the next installment, where we dissect the simulation results and unravel the mathematical nuances of early project task completion.&lt;/p&gt;

&lt;p&gt;Continue to Part 2: Analyzing Scenarios and Statistical Metrics&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Setting Up A FRESH Headless Wordpress site</title>
      <dc:creator>GeorgeMurphy-1</dc:creator>
      <pubDate>Wed, 15 Nov 2023 16:53:43 +0000</pubDate>
      <link>https://forem.com/georgemurphy/setting-up-a-fresh-headless-wordpress-site-21b0</link>
      <guid>https://forem.com/georgemurphy/setting-up-a-fresh-headless-wordpress-site-21b0</guid>
      <description>&lt;h2&gt;
  
  
  LocalWP
&lt;/h2&gt;

&lt;p&gt;Get local from &lt;a href="https://localwp.com/"&gt;https://localwp.com/&lt;/a&gt;&lt;br&gt;
Run the install&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WIPe8RUA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n4e47l3ah7b1r2n1ptdv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WIPe8RUA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n4e47l3ah7b1r2n1ptdv.png" alt="Image " width="750" height="583"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once installed, in the top left corner menu you will find the option to spin up a new site.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iENpQYPz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9fwws6fhc6gqx70a7mmr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iENpQYPz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9fwws6fhc6gqx70a7mmr.png" alt="Image " width="800" height="393"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XXxKHRAr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rczqw6wwnyk2dieywapy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XXxKHRAr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rczqw6wwnyk2dieywapy.png" alt="Image " width="414" height="496"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Create a new site using the gui&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CnP9arlf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ulax1nv7in4bfc2rv25j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CnP9arlf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ulax1nv7in4bfc2rv25j.png" alt="Image " width="800" height="451"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--c59cqNfE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xae5gj00fs68tgiab3vq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--c59cqNfE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xae5gj00fs68tgiab3vq.png" alt="Image " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GBQEFQ9b--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2mthbim73votu9k2s87s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GBQEFQ9b--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2mthbim73votu9k2s87s.png" alt="Image " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--56LRKCje--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8n7zbnytx8mz63yhtnwm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--56LRKCje--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8n7zbnytx8mz63yhtnwm.png" alt="Image " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You should now have you site up and running at the localhost port.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--L7aNz63m--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ednwc25yca7ips32rdpp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--L7aNz63m--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ednwc25yca7ips32rdpp.png" alt="Image " width="800" height="1217"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now log-in at &lt;a href="http://localhost:xxxx/wp-login.php"&gt;http://localhost:xxxx/wp-login.php&lt;/a&gt; where xxxx is your port number provided from the local app.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kEJyu6vh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vw24oml0g4xp623tz60z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kEJyu6vh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vw24oml0g4xp623tz60z.png" alt="Image " width="800" height="756"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Or Select one-click admin and use the wp admin button to log in.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3tnuCszs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4m8dd19fm7ruejq1vs24.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3tnuCszs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4m8dd19fm7ruejq1vs24.png" alt="Image " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;GO to plugins section, add a new plug in called &lt;strong&gt;wpgraphql&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wait, why use a plug-in instead of the default RestAPi?
&lt;/h2&gt;

&lt;p&gt;Wordpress as a content management platform can expose a Rest API to allow frontend or other services to access and manage its data. But, in doing so we get a response that contains essentially unfiltered data. To access the rest end points on your newly setup wordpress site go to this address but change example.com to your wordpress site url&lt;br&gt;
&lt;code&gt;http://example.com/?rest_route=/&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--74Z_DAWe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ytel8bwq2bczf26o0w0w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--74Z_DAWe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ytel8bwq2bczf26o0w0w.png" alt="Sample Rest data " width="800" height="272"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It is helpful to get a JSON formatter for humans to use in the browser so to be able to make sense of the output. Unless you are a machine.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7bUpvtK7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0yc3ywixc7jypviazn0c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7bUpvtK7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0yc3ywixc7jypviazn0c.png" alt="Image " width="800" height="804"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uYkkMRg9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5vfvs6imzbcq7yv4zxao.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uYkkMRg9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5vfvs6imzbcq7yv4zxao.png" alt="Parsed Json data form WP REST API" width="800" height="873"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--u87UkAeQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4j817ip4kt402jljq7nx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--u87UkAeQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4j817ip4kt402jljq7nx.png" alt="Post from wordpress Via REST API endpoint http://localhost:XXXXX/?rest_route=/wp/v2/posts Where xxxxx is your port" width="800" height="1274"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Graphql improves upon this. How? By improving upon how you access the data and what data is returned!&lt;br&gt;
Lest break that down with an example, &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;if one wanted to get the post data but only cared about the description one would have to work around the extra data attributes like tags, categories ect.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In addition, you are being sent data that is not needed but taking up time and space.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tHqWPeU0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wzaotxic8n9vri4a8vsn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tHqWPeU0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wzaotxic8n9vri4a8vsn.png" alt="Extra data sent when making request for post page with intention to get description only" width="800" height="401"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can access data much easier by specifing what  Well by using a query language and returning only the specified data/attributes. Grahql allows us to delve into the exact data through an easy to use declarative description of what data we want. Thus we can lower web traffic bandwidth. &lt;/p&gt;

&lt;p&gt;Rest works &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YTrAtnA5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6eqfml5rn6enqob9r0tv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YTrAtnA5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6eqfml5rn6enqob9r0tv.png" alt="Image " width="800" height="401"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With WPGraphQL installed you can use the IDE to create your queries.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ku2Xy7lu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tor5u0kivr9dc6n7k76l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ku2Xy7lu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tor5u0kivr9dc6n7k76l.png" alt="WPGraphQL IDE" width="800" height="392"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;query GetPosts {&lt;br&gt;
  posts {&lt;br&gt;
    nodes {&lt;br&gt;
      id&lt;br&gt;
      title&lt;br&gt;
      date&lt;br&gt;
    }&lt;br&gt;
  }&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tQYtakg3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ffed1d6zcet8u2opp4hx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tQYtakg3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ffed1d6zcet8u2opp4hx.png" alt="Output from Get post query looking for id title and date" width="708" height="694"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now taking the desired post id one can compose a query that allows for only the retrieval of the description for this post from the sever using this code.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;query GetSinglePost {&lt;br&gt;
  post(id: "cG9zdDox") {&lt;br&gt;
    id&lt;br&gt;
  }&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In the query body under post we would like describe what we want back as fields. We do not want the id so we remove that from the query fields. To identify the post we pass the id as an argument. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;query GetSinglePost {&lt;br&gt;
  post(id: "cG9zdDox") {&lt;br&gt;
    description&lt;br&gt;
  }&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WHZ-N-73--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yk33qyrgkq4j0vlbt11v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WHZ-N-73--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yk33qyrgkq4j0vlbt11v.png" alt="Output from query for post content" width="800" height="774"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To Remove the annoying extension field add this snippet in your functions.php.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;add_filter( 'graphql_request_results', function( $response ) {&lt;br&gt;
    if ( is_array( $response ) &amp;amp;&amp;amp; isset( $response['extensions'] ) ) {&lt;br&gt;
        unset( $response['extensions'] );&lt;br&gt;
    }&lt;br&gt;
    if ( is_object( $response ) &amp;amp;&amp;amp; isset( $response-&amp;gt;extensions ) ) {&lt;br&gt;
        unset( $response-&amp;gt;extensions );&lt;br&gt;
    }&lt;br&gt;
    return $response;&lt;br&gt;
}, 99, 1 );&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To get to functions.php, go to WPlocal app and find the go to folder buttoon  for your wordpress site.&lt;/p&gt;

&lt;p&gt;add this snippet to end of the file and save.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--AfKkkY0w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6vtez92y5lt71jlz2yz4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AfKkkY0w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6vtez92y5lt71jlz2yz4.png" alt="Getting to file directory" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Mwnd9bKb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h1312sd5a8md0rcubbg4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Mwnd9bKb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h1312sd5a8md0rcubbg4.png" alt="Root Folder Set Up" width="553" height="201"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Go through app-&amp;gt; public-&amp;gt; wp-content-&amp;gt; themes-&amp;gt; twentytwentyfour&lt;/p&gt;

&lt;p&gt;if you are using a different theme change twentytwentyfour to that theme folder.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nq5FIXxy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g60j67xvzr4xo0um6utx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nq5FIXxy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g60j67xvzr4xo0um6utx.png" alt="Image " width="304" height="367"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Copy the address. Open command line and cd to that address.&lt;br&gt;
Next run &lt;code&gt;nvim functions.php&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Add code to end of file. Save and close the file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9_Jc5hR9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6aq8erbatc5n1flq1xy1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9_Jc5hR9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6aq8erbatc5n1flq1xy1.png" alt="Paste in code to functions.php" width="800" height="710"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Jhx0rb-4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9h5u9gf76adjim3s5sjd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Jhx0rb-4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9h5u9gf76adjim3s5sjd.png" alt="Restart Local" width="275" height="177"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Restart WPLocal and test your query again.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Gyso7E59--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t38p5tdux9in8g0v6gli.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Gyso7E59--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t38p5tdux9in8g0v6gli.png" alt="View of graphql query response" width="800" height="193"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You now have a FRESH headless Wordpress site ready to go!&lt;/p&gt;

&lt;p&gt;Feel free to contact me if you have any questions or edits!&lt;br&gt;
&lt;a href="mailto:murfg25@gmail.com"&gt;murfg25@gmail.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>wordpress</category>
      <category>headless</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Turning on REST API for WooCommerce</title>
      <dc:creator>GeorgeMurphy-1</dc:creator>
      <pubDate>Thu, 21 Sep 2023 23:09:53 +0000</pubDate>
      <link>https://forem.com/georgemurphy/turning-on-rest-api-for-woocommerce-2eg7</link>
      <guid>https://forem.com/georgemurphy/turning-on-rest-api-for-woocommerce-2eg7</guid>
      <description>&lt;p&gt;What's up, folks!&lt;/p&gt;

&lt;p&gt;In this article, you'll discover how to activate the REST API for your WooCommerce site.&lt;/p&gt;

&lt;h2&gt;
  
  
  Ready to dive in? Let's roll:
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Head over to your WordPress Admin Dashboard.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In order to access REST API end points you must change your permalinks style from plain to any other format.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Navigate to WooCommerce -&amp;gt; Settings.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Inside WooCommerce Settings, find the "Advanced" tab.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In the "Legacy API" section, you'll come across an option labeled "Enable REST API." &lt;strong&gt;Don't&lt;/strong&gt; check this box. This API is deprecated and not suitable for new projects. The WooCommerce Legacy REST API uses a different JSON format for request and response bodies compared to the modern WooCommerce REST API. It also relies on Basic Authentication instead of OAuth for security.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Save Changes:&lt;/strong&gt;&lt;br&gt;
Once you've made sure not to enable the deprecated REST API, scroll down to the bottom of the page and hit the "Save changes" button. This step activates the REST API for your WooCommerce site.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Voilà! You've successfully enabled the REST API for your WooCommerce site, opening the doors to communication with various applications like a React front-end or mobile apps for Android or iOS.&lt;/p&gt;

&lt;p&gt;Don't forget to configure authentication and permissions for your API to ensure data security and control over its functionality.&lt;/p&gt;

&lt;p&gt;Stay tuned for more WooCommerce wisdom!&lt;/p&gt;

&lt;p&gt;-George Murphy&lt;/p&gt;

</description>
      <category>restapi</category>
      <category>wordpress</category>
      <category>security</category>
      <category>woocommerce</category>
    </item>
  </channel>
</rss>
